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 */ }