WinShowWindow
Appearance
This function sets the visibility state of a window.
Syntax
WinShowWindow(hwnd, fNewVisibility)
Parameters
- hwnd (HWND) - Input
- Window handle.
- fNewVisibility (BOOL) - Input
- New visibility state. TRUE to set the window state to visible, FALSE to set it to invisible.
Returns
- rc (BOOL) - returns
- Visibility changed indicator.
- TRUE
- Window visibility successfully changed.
- FALSE
- Window visibility not successfully changed.
Remarks
A window has a visibility state indicated by the WS_VISIBLE style bit. When this bit is set, the window is shown, and subsequent drawing is presented unless the window is obscured or an ancestor in the parent chain does not have the WS_VISIBLE style.
When the WS_VISIBLE style bit is not set, the window is hidden, and drawing is not presented, even if the window is not obscured.
If the WS_VISIBLE style bit's value is changed, the WM_SHOW message is sent to the window of hwnd before the function returns.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ #include <os2.h> HWND hwnd; /* Window handle. */ BOOL fNewVisibility; /* New visibility state. */ BOOL rc; /* Visibility changed indicator. */ rc = WinShowWindow(hwnd, fNewVisibility);
This example shows a modeless dialog window.
#define INCL_WINWINDOWMGR #define INCL_WINDIALOGS #include <OS2.H> #define DLG_MODELESS 900 /* dialog procedure declaration. */ MRESULT EXPENTRY DlgProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2 ); HWND hwnd; hwnd = WinLoadDlg( HWND_DESKTOP, HWND_OBJECT, (PFNWP)DlgProc, (HMODULE)NULL, DLG_MODELESS, NULL); /* DlgProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2 ) { CASE USER_DEFINED: */ WinShowWindow( hwnd, TRUE ); /* show window. */ WinSetFocus( HWND_DESKTOP, hwnd ); }
Related Messages
Related Functions
- WinBeginPaint
- WinEnableWindowUpdate
- WinEndPaint
- WinExcludeUpdateRegion
- WinGetClipPS
- WinGetPS
- WinGetScreenPS
- WinInvalidateRect
- WinInvalidateRegion
- WinIsWindowShowing
- WinIsWindowVisible
- WinLockVisRegions
- WinOpenWindowDC
- WinQueryUpdateRect
- WinQueryUpdateRegion
- WinRealizePalette
- WinReleasePS
- WinUpdateWindow
- WinValidateRect
- WinValidateRegion