ShowWindow (Compact 2013)

3/28/2014

This function determines whether the specified window is displayed and how it is displayed.

Syntax

BOOL ShowWindow(
  HWND hWnd,
  int nCmdShow
); 

Parameters

  • hWnd
    [in] Handle to the window.
  • nCmdShow
    [in] Specifies how the window is to be displayed. 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.

    Value

    Description

    SW_HIDE

    Hides the window and activates another window.

    SW_SHOW

    Activates the window and displays it in its current size and position.

    SW_SHOWNA

    Displays the window in its current state. The active window remains active.

    SW_SHOWNORMAL

    Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. Use this flag when you display a window for the first time.

Return Value

Returns a nonzero value to indicate that the window was previously visible. A return value of zero indicates that the window was previously hidden.

Remarks

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.

Requirements

Header

winuser.h

See Also

Reference

Window Functions
CreateWindow
WinMain

Other Resources

CreateProcess