Although most applications do not alter the system menu, you can obtain the handle of the system menu by calling WinWindowFromID with a frame-window handle (or dialog-window handle) and the identifier FID_SYSMENU. Once you have the handle of the system menu, you can access the individual menu items by using predefined constants. For example, the following code fragment shows how to disable the Close menu item in the system menu of a window:
HWND hwndSysMenu; HWND hwndFrame; hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); WinSendMsg(hwndSysMenu, MM_SETITEMATTR, MPFROM2SHORT(SC_CLOSE, TRUE), MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));