HOWTO: Query and Modify the States of System Menu Items

ID: Q83453


The information in this article applies to:


SUMMARY

An application should query or set states of the Restore, Move, Size, Minimize, and Maximize items on the system menu during the processing of a WM_INITMENU or a WM_INITMENUPOPUP message.


MORE INFORMATION

Windows changes the state of the Restore, Move, Size, Minimize, and Maximize items on the system menu just before it draws the menu on the screen and sends the WM_INITMENU and WM_INITMENUPOPUP messages.

Windows sets the states of these menu items according to the state of the window just before the menu is displayed. For example, if the window is minimized when its system menu is pulled down, the Minimize menu item is unavailable (grayed). If an overlapped window is maximized when its system menu is pulled down, the Move, Size, and Maximize items are unavailable.

If an application queries or sets the state of any of these system menu items, the query or change should occur during the processing of the WM_INITMENU or WM_INITMENUPOPUP message. If any menu item state is queried before one of these messages is processed, it could reflect a previous state of the window. If any state is set before one of these messages is processed, Windows will reset the menu items to correspond to the state of the window just prior to sending these messages.

Windows does not change the state of the Close menu item. Its state can be changed or queried at any time.




Keywords          : kbMenu kbNTOS350 kbNTOS351 kbGrpUser kbWinOS310 kbWinOS95 kbWinOS300 
Version           : 
Platform          : 
Issue type        : kbhowto 

Last Reviewed: March 7, 1999