This example calls WinWindowFromID to get the window handle of the system menu and calls WinSendMsg to send a message to disable the Close menu item.
#define INCL_WINFRAMEMGR /* for FID_ definitions. */ #define INCL_WINMENUS /* for MIA_ definitions. */ #define INCL_WINWINDOWMGR #include <OS2.H> HWND hwndSysMenu, hwndDlg; hwndSysMenu = WinWindowFromID(hwndDlg, FID_SYSMENU); WinSendMsg(hwndSysMenu, MM_SETITEMATTR, MPFROM2SHORT(SC_CLOSE, TRUE), MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));