Reputation: 127
To check if a window is visibile i have to use:
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);
But how do i change the visiblity? True/False
EDIT:
Hiding works:
Process P;
P = Process.GetProcessesByName("javaw")[2];
ShowWindow(P.MainWindowHandle, 0);
But showing does not:
Process P;
P = Process.GetProcessesByName("javaw")[2];
ShowWindow(P.MainWindowHandle, 5);
EDIT:
ShowWindow(FindWindow(null, "WINDOWNAME"), 0);
0 invisibvle 5 visible
WORKS
Upvotes: 1
Views: 1252
Reputation: 3480
You can use ShowWindow:
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow);
Upvotes: 3