CFrameWnd::m_bAutoMenuEnable
When this data member is enabled (which is the default), menu items that do not have ON_UPDATE_COMMAND_UI or ON_COMMAND handlers will be automatically disabled when the user pulls down a menu.
BOOL m_bAutoMenuEnable;
Remarks
Menu items that have an ON_COMMAND handler but no ON_UPDATE_COMMAND_UI handler will be automatically enabled.
When this data member is set, menu items are automatically enabled in the same way that toolbar buttons are enabled.
Note
m_bAutoMenuEnable has no effect on top-level menu items.
This data member simplifies the implementation of optional commands based on the current selection and reduces the need to write ON_UPDATE_COMMAND_UI handlers for enabling and disabling menu items.
Example
CMainFrame::CMainFrame()
: m_hDrawMenu(NULL)
, m_hDrawAccel(NULL)
, m_bCheck(false)
, m_nTimer(0)
{
// Set to FALSE so no ON_UPDATE_COMMAND_UI
// or ON_COMMAND handlers are needed, and
// CMenu::EnableMenuItem() will work as expected.
m_bAutoMenuEnable = FALSE;
}
Requirements
Header: afxwin.h