Solved

GRAYED Menu Items

Posted on 1998-07-06
4
253 Views
Last Modified: 2013-11-19
I am aware of the EnabledMenuItem fuction which takes three parameters.  How to a get the handler of the default menu??
The other two parameters are self explanatory.
0
Comment
Question by:mikeljj
  • 2
4 Comments
 

Expert Comment

by:zingo
ID: 1318774
This is the "MFC Programming Question" area, so I guess the best answer I could give you is to use CMenu, which has its own version of EnableMenuItem. Then you don't need the handle.

CMenu menu;
if (menu.LoadMenu(IDR_MY_MENU))
{
  menu.EnableMenuItem(nIDEnableItem, nEnable);
}

0
 
LVL 4

Expert Comment

by:piano_boxer
ID: 1318775
GetMenu() will return a pointer to the windows menu. (Call this in CMainFrame if you want to get the app manu).
0
 

Author Comment

by:mikeljj
ID: 1318776
piano boxer, can I call this from CView??
0
 
LVL 4

Accepted Solution

by:
piano_boxer earned 50 total points
ID: 1318777
You can call GetMenu() from any window, and it will return a pointer to *its* own menu.

But I dont think your CView class has any menu, the menu proberly belongs to CMainFrame.

To get the app's menu from anywhere do this:

CMenu* pMenu = AfxGetMainWnd()->GetMenu();
ASSERT_VALID(pMenu);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 106
ODBC Connection Logging, ADO.NET 6 56
while loop over for loop 7 93
has77  challenge 9 73
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…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now