WinIsControlEnabled
Appearance
This function returns the state (enabled/disabled) of the specified item in the dialog template within a dialog box.
Syntax
WinIsControlEnabled(hwndDlg, usId)
Parameters
Returns
- rc (BOOL) - returns
- Enabled-state indicator.
- TRUE
- Specified item is enabled.
- FALSE
- Specified item is disabled.
Remarks
This macro expands to&colon.
#define WinIsControlEnabled(hwndDlg, usId) ((BOOL)WinIsWindowEnabled(WinWindowFromID(hwndDlg, usId)))
This function requires the existence of a message queue.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDlg; /* Dialog window handle. */ USHORT usId; /* Identity of the specified item. */ BOOL rc; /* Enabled-state indicator. */ rc = WinIsControlEnabled(hwndDlg, usId);
This example uses WinIsControlEnabled to determine if a selected control is valid; if it is not, an error message box is displayed.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINDIALOGS /* Window Dialog Mgr Functions */ #include <os2.h> HWND hwndDlg; /* Dialog window */ MPARAM mp1; /* Parameter 1 */ USHORT usId; /* Dialog control id */ case WM_CONTROL: usId = SHORT1FROMMP(mp1); if (!WinIsControlEnabled(hwndDlg, usId)) { WinMessageBox(HWND_DESKTOP, hwndDlg, /* Client-window handle */ "Control is not valid", /* Body of the message */ "Error notification", /* Title of the message */ 0, /* Message box id */ MB_NOICON | /* Button flag */ MB_OK); /* Icon flag */ }