Solved

GRAYED Menu Items

Posted on 1998-07-06
4
255 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 94
Include multiple hostnames in this command? 3 55
Get filename and folder into excel 7 79
Problem to App source 6 73
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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