Manipulate opened windows

by on Feb.19, 2013, under C#

Let’s see how we can maximize, minimize, set to normal or hide opened windows using C# and Windows API.

//..
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int status);
 
private const int SWHIDE = 0;
private const int SWSHOWNORMAL = 1;
private const int SWSHOWMINIMIZED = 2;
private const int SWSHOWMAXIMIZED = 3;
//..

Maximize

ShowWindowAsync(new IntPtr(some_window_handle_id), SWSHOWMAXIMIZED);

Minimize

ShowWindowAsync(new IntPtr(some_window_handle_id), SWSHOWMINIMIZED);

Normal

ShowWindowAsync(new IntPtr(some_window_handle_id), SWSHOWNORMAL);

Normal

ShowWindowAsync(new IntPtr(some_window_handle_id), SWHIDE);
:, ,

%d bloggers like this: