This example uses WinIsWindow to verify that the parent window is valid before querying and enabling the system menu window via WinIsWindowEnabled and WinEnableWindow.

#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 the handle specifies a valid window,              */
/* query the enabled status of the system menu.         */
if (WinIsWindow(hab, hwnd))
{
  /* 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);
}


[Back] [Next]