Solved

GRAYED Menu Items

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

776 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