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