ShowWindow Function

Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

ShowWindow shows (or hides) a window in a certain manner. For example, the function can minimize, maximize, or restore a given window. The function returns 0 if the window had been hidden before the call, or a non-zero value if it had been visible.

hwnd
The handle of the window to change the show status of.
nCmdShow
Exactly one of the following flags specifying how to show the window:
SW_HIDE = 0
Hide the window.
SW_MAXIMIZE = 3
Maximize the window.
SW_MINIMIZE = 6
Minimize the window.
SW_RESTORE = 9
Restore the window (not maximized nor minimized).
SW_SHOW = 5
Show the window.
SW_SHOWMAXIMIZED = 3
Show the window maximized.
SW_SHOWMINIMIZED = 2
Show the window minimized.
SW_SHOWMINNOACTIVE = 7
Show the window minimized but do not activate it.
SW_SHOWNA = 8
Show the window in its current state but do not activate it.
SW_SHOWNOACTIVATE = 4
Show the window in its most recent size and position but do not activate it.
SW_SHOWNORMAL = 1
Show the window and activate it (as usual).

Example:

' Maximize the window Form1.  Before doing so, make sure
' that the window is visible.
Dim retval As Long  ' return value

retval = ShowWindow(Form1.hWnd, SW_SHOW)  ' display the window if it's hidden
retval = ShowWindow(Form1.hWnd, SW_MAXIMIZE)  ' maximize the window

See Also: IsIconic, IsZoomed
Category: Windows

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/showwindow.html