Click to See Complete Forum and Search --> : need help desparate


Al
March 29th, 1999, 10:21 AM
I have a class CMainFrame - how MFC makes my menu automatically I am a beginner so I am not totally sure. I have spent the weekend at

Barnes & Noble looking at (very little examples in all these C books) of how

you can add:


pseudo:

class CMainFrame

private:

CMenu pMenu;

etc..

Then when the app makes an instance in MainFrame.cpp

you add pMenu.LoadMenu(IDR_MAINFRAME);

SetMenu(&pMenu);


At that point I added code to initially set a menu item to GRAY

because I want to control the user into logging on

This returns with the right number which is 2::::

pMenu.CheckMenuItems(ID_LOGON,MF_BYCOMMAND|MF_DISABLE);

But when you check the menu in debug mode or on regualr

the menu item is not grayed out.


I tried using spy like my dad said, but it does not give me menu handle or I cannot see it


Thanks for all your help.

Ali Zamurad
March 29th, 1999, 03:03 PM
Hi,

Welcome to MFC. Its easy if you want to have a GRAYED item in the beginning of

your program. Just use the resource editor and select menu resource and change

the property of the desired item to GRAY.

Hope that help. Anyother question you are welcome.

Good Luck

AZ

Al
March 29th, 1999, 10:48 PM
Okay How do I ungray it - the reason I did not do it that way was to learn how to intercept

my menus. In all the examples I have seen it is as easy as CMenu *pMenu

then pMenu->EnableMenuItem(ID, MF_BYNAME??|MF_GRAYED);


THAT HAS NOT WORKED AND IN THE DEBUGGER I SEE A VALID POINTER TO pMEnu

In other words it has a valid handle.