Solved

GRAYED Menu Items

Posted on 1998-07-06
4
257 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
[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
  • 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

724 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