HMENU GetSystemMenu(hWnd,bRevert)
This function allows the application to access the System menu for copying and modifi-cation.
Parameter | Type/Description |
hWnd | HWND Identifies the window that will own a copy of the System menu. | ||
bRevert | BOOL Specifies the action to be taken. | ||
If bRevert is: | Description | ||
zero | GetSystemMenu returns a handle to a copy of the System menu currently in use. This copy is initially identical to the System menu, but can be modified. | ||
nonzero | GetSystemMenu destroys the possibly modified copy of the System menu (if there is one) that belongs to the specified window and returns a handle to the original, unmodified version of the System menu. |
The return value identifies the System menu if bRevert is nonzero and the System menu has been modified. If bRevert is nonzero and the System menu has not been modified, the return value is NULL. If bRevert is zero, the return value identifies a copy of the System menu.
Any window that does not use the GetSystemMenu function to make its own copy of the System menu receives the standard System menu.
The handle returned by the GetSystemMenu function can be used with the AppendMenu, InsertMenu or ModifyMenu functions to change the System menu. The System menu initially contains items identified with various ID values such as SC_CLOSE, SC_MOVE, and SC_SIZE. Menu items on the System menu send WM_SYSCOMMAND messages. All predefined System-menu items have ID numbers greater than 0xF000. If an application adds commands to the System menu, it should use ID numbers less than F000.
Windows automatically grays items on the standard System menu, depending on the situation. The application can carry out its own checking or graying by responding to the WM_INITMENU message, which is sent before any menu is displayed.