Set the form display status (ShowWindow)

Source: Internet
Author: User

The API function ShowWindow is used to set the display state of the form. The prototype declaration is as follows:

BOOL ShowWindow (
HWND hwnd,//Handle to Window
int nCmdShow//show State
);

The first parameter hWnd specifies a handle to the window to be set. The second parameter specifies a predefined constant, with the following values:

Sw_forceminimize:
Windows 2000/xp:minimizes A window, even if the thread that owns the window
is hung. This flag should is used when minimizing windows from a different
Thread.
  
Sw_hide:
Hides the form and activates another form.

Sw_maximize:
Maximizes the specified form.

Sw_minimize:
Minimizes a specified form and activates the next form on the z-axis (z-axis conceptual reference SetWindowPos API function).

Sw_restore:
Activates and displays a specified form, and if the form is minimized or maximized, the system restores it to a normal large
Small and position. When a minimized window is restored, the application should contain this flag.

Sw_showdefault:
Sets the show state based on the sw_value specified in the Startupinfo stru
Cture passed to the CreateProcess function by the program that started the Appli
cation.
This means that, when the program starts running, the Sw_value parameter based on the CreateProcess function
Specifies the STARTUPINFO structure to set the state.
typedef struct _STARTUPINFO {
DWORD CB;
LPTSTR lpreserved;
LPTSTR LpDesktop;
LPTSTR Lptitle;
DWORD DwX;
DWORD DwY;
DWORD dwxsize;
DWORD dwysize;
DWORD Dwxcountchars;
DWORD Dwycountchars;
DWORD Dwfillattribute;
DWORD DwFlags;
WORD Wshowwindow;
WORD CbReserved2;
Lpbyte LpReserved2;
HANDLE hStdInput;
HANDLE Hstdoutput;
HANDLE Hstderror;
} Startupinfo, *lpstartupinfo

Sw_showmaximized:
Activates a window and displays it in a maximized state.

Sw_showminimized:
Activates a window and displays it in a minimized state.

Sw_showminnoactive:
Displays a form in a minimized state, unless the form is inactive, the effect of this function is similar to
Sw_showminimized.

Sw_showna:
Displays a form at its current size and position, unless the form is inactive, or the function works like
To Sw_show.

Sw_shownoactivate:
Displays a form in the most recent state. Unless the window sill is inactive, the effect of this function is similar to
Sw_shownormal.

Sw_shownormal:
Activates and displays a form that reverts to the default size and position if the form is maximized or minimized.
This flag should be set when the program displays a window for the first time.

Typical applications:
ShowWindow (Self.handle, sw_showmaximized);
Displays a maximized form.

   

Set the form display status (ShowWindow)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.