CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 1999
    Location
    Blue Mountains Australia
    Posts
    11

    need help desparate



    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.



  2. #2
    Join Date
    Apr 1999
    Location
    Plano, TX, U.S.A
    Posts
    7

    Re: need help desparate



    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

  3. #3
    Join Date
    Mar 1999
    Location
    Blue Mountains Australia
    Posts
    11

    Re: need help desparate



    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured