Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.


The framework calls this member function when a menu is about to become active.

afx_msg void OnInitMenu(
   CMenu* pMenu 


Specifies the menu to be initialized. May be temporary and should not be stored for later use.


The call occurs when the user clicks an item on the menu bar or presses a menu key. Override this member function to modify the menu before it is displayed.

OnInitMenu is only called when a menu is first accessed; OnInitMenu is called only once for each access. This means, for example, that moving the mouse across several menu items while holding down the button does not generate new calls. This call does not provide information about menu items.

Note   This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

See Also

CWnd Overview | Class Members | Hierarchy Chart | CWnd::OnInitMenuPopup | WM_INITMENU

© 2016 Microsoft