WinEnableWindow
Appearance
This function sets the window enabled state.
Syntax
WinEnableWindow(hwnd, fNewEnabled);
Parameters
- hwnd (HWND) - input
- Window handle.
- fNewEnabled (BOOL) - input
- New enabled state.
- TRUE
- Set window state to enabled
- FALSE
- Set window state to disabled.
Returns
- rc (BOOL) - returns
- Window enabled indicator.
- TRUE
- Window enabled state successfully updated
- FALSE
- Window enabled state not successfully updated.
ERRORS
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Example Code
This example uses WinEnableWindow to enable the system menu window for the given parent window, after verifying that the parent window handle is valid (WinIsWindow), belongs to the calling thread (WinIsThreadActive), and is not presently enabled (WinIsWindowEnabled).
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINFRAMEMGR /* Window Frame Functions */ #include <os2.h> HAB hab; /* anchor-block handle */ HWND hwndSysmenu; /* system menu window */ HWND hwnd; /* parent window */ BOOL fSuccess; /* success indicator */ /* if handle specifies a valid window and the window belongs to the current thread, query the enabled status of the system menu */ if (WinIsWindow(hab, hwnd) && WinIsThreadActive(hab)) { /* obtain handle for system menu */ hwndSysmenu = WinWindowFromID(hwnd,FID_SYSMENU); /* if system menu is not enabled, enable it */ if (!WinIsWindowEnabled(hwndSysmenu)) fSuccess = WinEnableWindow(hwndSysmenu, TRUE); }
Definition
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ BOOL fNewEnabled; /* New enabled state. */ BOOL rc; /* Window enabled indicator. */ rc = WinEnableWindow(hwnd, fNewEnabled);
Related Functions
- WinIsThreadActive
- WinIsWindow
- WinIsWindowEnabled
- WinQueryDesktopWindow
- WinQueryObjectWindow
- WinQueryWindowDC
- WinQueryWindowProcess
- WinQueryWindowRect
- WinWindowFromDC
- WinWindowFromID
- WinWindowFromPoint
Related Messages
- WM_ENABLE