WinIsWindowEnabled: Difference between revisions
Appearance
Created page with " This function returns the state (enabled/disabled) of a window. ==Syntax== WinIsWindowEnabled(hwnd) ==Parameters== hwnd (HWND) - input Window handle. ==Returns==..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function returns the state (enabled/disabled) of a window. | |||
This function returns the state (enabled/disabled) of a window. | |||
==Syntax== | ==Syntax== | ||
Line 6: | Line 5: | ||
==Parameters== | ==Parameters== | ||
;hwnd (HWND) - input:Window handle. | |||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns | ;rc (BOOL) - returns:Enabled-state indicator. | ||
:Enabled-state indicator. | :;TRUE:Window is enabled. | ||
:;TRUE | :;FALSE:Window is disabled. | ||
:;FALSE | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INVALID_HWND (0x1001) | ;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified. | ||
:An invalid window handle was specified. | |||
==Example Code== | ==Example Code== | ||
Line 42: | Line 34: | ||
if (!WinIsWindowEnabled(hwndSysmenu)) | if (!WinIsWindowEnabled(hwndSysmenu)) | ||
fSuccess = WinEnableWindow(hwndSysmenu, TRUE); | fSuccess = WinEnableWindow(hwndSysmenu, TRUE); | ||
</pre> | </pre> | ||
Line 55: | Line 45: | ||
rc = WinIsWindowEnabled(hwnd); | rc = WinIsWindowEnabled(hwnd); | ||
</pre> | </pre> | ||
Line 70: | Line 58: | ||
* WinWindowFromDC | * WinWindowFromDC | ||
* WinWindowFromID | * WinWindowFromID | ||
* WinWindowFromPoint | * WinWindowFromPoint | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 14:15, 4 October 2023
This function returns the state (enabled/disabled) of a window.
Syntax
WinIsWindowEnabled(hwnd)
Parameters
- hwnd (HWND) - input
- Window handle.
Returns
- rc (BOOL) - returns
- Enabled-state indicator.
- TRUE
- Window is enabled.
- FALSE
- Window is disabled.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Example Code
This example uses WinIsWindowEnabled to check that the parent window is currently disabled before calling WinEnableWindow to enable the system menu window.
#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 */ /* Obtain the handle for the system menu */ hwndSysmenu = WinWindowFromID(hwnd,FID_SYSMENU); /* If the system menu is disabled, 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 rc; /* Enabled-state indicator. */ rc = WinIsWindowEnabled(hwnd);
Related Functions
- WinEnableWindow
- WinIsThreadActive
- WinIsWindow
- WinQueryDesktopWindow
- WinQueryObjectWindow
- WinQueryWindowDC
- WinQueryWindowProcess
- WinQueryWindowRect
- WinWindowFromDC
- WinWindowFromID
- WinWindowFromPoint