Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Menu Items are disabled. MFC?

Posted on 2003-11-10
1
Medium Priority
?
846 Views
Last Modified: 2013-11-20
I am new to MFC. I just created a menu (by modifying MFC's default SDI menu). When I test-run the program, a bunch of my newly created menu items (selected seemingly arbitrarily) come out DISABLED. Does anyone know why? I searched the program's files for calls to EnableMenuItem() and found nothing. It's really annoying not to have control over such things. Do I have to overwrite CWnd::OnInitMenuPopup() to prevent this from happening or is there a way to disable this MFC feature without it?
Thanks in advance.  
0
Comment
Question by:abuly80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
AlexFM earned 480 total points
ID: 9717014
By default menu item in MFC SDI application is disabled if you don't handle it. Once you add menu item handler, menu is enabled. If you want to enable/disable menu item programmatically, handle WM_COMMAND_UI for this item:

void CMainFrame::OnUpdateMenuItem(CCmdUI* pCmdUI)
{
    pCmdUI->Enable(m_bEnabelFlag);
}

m_bEnabelFlag - some variable or condition. Setting it to TRUE enables menu ite, to FALSE - disables.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question