다음을 통해 공유


ShowWindow

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function sets the specified window's show state.

Syntax

BOOL ShowWindow( 
  HWND hWnd, 
  int nCmdShow 
); 

Parameters

  • hWnd
    [in] Handle to the window.
  • nCmdShow
    [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.

    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. An application should specify this flag when displaying the window for the first time.

Return Value

Nonzero indicates that the window was previously visible. 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
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CreateWindow
WinMain
Windows Functions

Other Resources

CreateProcess