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); }