Discussion:
access to SDI menu ?
(too old to reply)
Z.K.
2006-10-12 14:55:04 UTC
Permalink
How do I get access to the SDI menu? I want to be able to add or gray out a
menu item in code so that if I click a menu item it will gray out or if it
detects that it is in a certain mode on startup the menu will hide itself.
I tried using the code below, but it always crashes the program when I tried
to get the menu item count. I thought maybe the menu had not been created
yet, so I put the code in a button handler and it did the samething. What
am I doing wrong?
CMenu *myMenu;

myMenu = GetMenu();

//myMenu->EnableMenuItem(

UINT count = myMenu->GetMenuItemCount();


Z.K.
David Lowndes
2006-10-12 16:21:06 UTC
Permalink
Post by Z.K.
How do I get access to the SDI menu? I want to be able to add or gray out a
menu item in code so that if I click a menu item it will gray out or if it
detects that it is in a certain mode on startup the menu will hide itself.
You're going about it the wrong way for MFC. The MFC application
framework has a mechanism to enable/disable menu items - see
ON_UPDATE_COMMAND_UI and the topic titled "How to: Update
User-Interface Objects" for starters.

Dave

Continue reading on narkive:
Loading...