This function sets the specified window's show state.
BOOL ShowWindow( HWND hWnd, int nCmdShow );
[in] Handle to the window.
[in] Specifies how the window is to be shown. The first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values.
Hides the window and activates another window.
Activates the window and displays it in its current size and position.
Displays the window in its current state. The active window remains active.
Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.
Calling PeekMessage before the top level window of an application is created will result in the window being created at the back of the z-order. You will need to explicitly call SetForegroundWindowto show the window when it is created after a call to PeekMessage. If the application already has a window in the foreground, then the new window will be created in the foreground.