WinEnableWindowUpdate
This function sets the window visibility state for subsequent drawing.
Syntax
WinEnableWindowUpdate(hwnd, fEnable)
Parameters
- hwnd (HWND) - Input
- Window handle.
- fEnable (BOOL) - Input
- New visibility state.
- rc (BOOL) - Returns
- Visibility-changed indicator.
Returns
- rc (BOOL) - returns
- Visibility-changed indicator.
- TRUE
- Window visibility successfully changed
- FALSE
- Window visibility not successfully changed.
Remarks
This function can be used to defer drawing when making a series of changes to a window. A window can be redrawn by using the WinShowWindow function.
WS_VISIBLE (style bit of a window) is set to fEnable without causing redrawing. That is, if the window was previously visible, it remains visible on the device when WS_VISIBLE is set to 0, and if the window was previously invisible, it is not shown when WS_VISIBLE is set to 1. If fEnable is set to TRUE, any subsequent drawing into the window is visible. If fEnable is set to FALSE, any subsequent drawing into the window is not visible.
If the value of the WS_VISIBLE style bit has been changed, the WM_SHOW message is sent to the window of hwnd before the call returns.
Any alteration to the appearance of a window disabled for window update is not presented. Therefore, the application must ensure that the window is redrawn. To show a window and ensure that it is redrawn after calling the WinEnableWindowUpdate function with fEnable set to FALSE, use the WinShowWindow function with fNewVisibility set to TRUE. In particular, if a window is destroyed while in this state its image is not removed from the display. After window updating is reenabled, the application should ensure that the window gets totally invalidated so that it repaints.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.
- PMERR_INVALID_FLAG (0x1019) - An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ BOOL fEnable; /* New visibility state. */ BOOL rc; /* Visibility-changed indicator. */ rc = WinEnableWindowUpdate(hwnd, fEnable);
This example uses WinEnableWindowUpdate to set a window's WS_VISIBLE style to visible and cause the window to be updated by a WM_PAINT message.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> HWND hwnd; /* parent window */ BOOL fSuccess; /* success indicator */ case WM_CREATE: /* if window has WS_VISIBLE off, set state to visible */ if (!WinIsWindowVisible(hwnd)) { /* set state to visible and cause WM_PAINT message */ fSuccess = WinEnableWindowUpdate(hwnd, EWUF_ENABLE); }
Related Messages
Related Functions
- WinBeginPaint
- WinEnableWindowUpdate
- WinEndPaint
- WinExcludeUpdateRegion
- WinGetClipPS
- WinGetPS
- WinGetScreenPS
- WinInvalidateRect
- WinInvalidateRegion
- WinIsWindowShowing
- WinIsWindowVisible
- WinLockVisRegions
- WinOpenWindowDC
- WinQueryUpdateRect
- WinQueryUpdateRegion
- WinRealizePalette
- WinReleasePS
- WinShowWindow
- WinUpdateWindow
- WinValidateRect
- WinValidateRegion