In my MFC program, Im trying to disable a menu item with EnableMenuItem(), but it doesn have any effect on the menu. Why?
MFC uses its own system for enabling and disabling menu items and toolbar buttons, which overrides any calls you make to EnableMenuItem(). If you look in the message map of your CMainFrame class, you may see some ON_UPDATE_COMMAND_UI() macros. Those macros control when menu items and toolbar buttons are enabled and disabled. To add a macro for the menu item you want to disable, go to ClassWizard and click the Message Maps tab. In the Class name combo box, select the class where you want to add the handler (usually CMainFrame is a good choice, but for items that relate to data stored in your document, pick your CDocument-derived class instead). In the Object IDs list, select the command ID of the menu item, then in the Messages list, double-click UPDATE_COMMAND_UI.