ShowWindow

InstallShield 2020 » InstallScript Language Reference

The ShowWindow function sets the specified window's show state.

Syntax

BOOL ShowWindow(
  HWND hWnd, // handle to window
  int nCmdShow // show state
);

Parameters

ShowWindow Parameters

Parameter

Description

hWnd

Specifies the handle to the window.

nCmdShow

Specifies the show state of the window. If the program that launched the application includes a STARTUPINFO structure, this parameter is ignored the first time the application calls ShowWindow. Otherwise, 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.

SW_FORCEMINIMIZE—Minimizes a window, even if the thread that owns the window is not responding. This value should only be used when minimizing windows from a different thread.
SW_HIDE—Hides the window and activates another window.
SW_MAXIMIZE—Maximizes the specified window.
SW_MINIMIZE—Minimizes the specified window and activates the next top-level window in the Z order. The Z order is the position of a window in a stack of overlapping windows on the z axis, which indicates depth.
SW_RESTORE—Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this value when restoring a minimized window.
SW_SHOW—Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT—Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED—Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED—Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE—Displays the window as a minimized window. The active window remains active.
SW_SHOWNA—Displays the window in its current size and position. The active window remains active.
SW_SHOWNOACTIVATE—Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL—Activates and displays a window. If the window is minimized or maximized, it is restored it to its original size and position. An application should specify this value when displaying the window for the first time.

Return Values

ShowWindow Return Values

Return Value

Description

Nonzero

The return value is nonzero if the window was visible.

0

The return value is 0 if the window was hidden.

Additional Information

This information was adapted from the MSDN topic ShowWindow Function.