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;

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.


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.

   : m_hDrawMenu(NULL)
   , m_hDrawAccel(NULL)
   , m_bCheck(false)
   , m_nWindowTimer(0)
   , m_nCallbackTimer(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;


Header: afxwin.h

© 2015 Microsoft