CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    disable MenuItems in CDialog

    Hi,

    I have a CDialog who has a menu IDR_MAINFRAME.
    I want to disable some menu items at the beginning.
    I used GetDlgItem(ID_EDIT); to get a CWnd* for the enableWindow-function,
    but I get a NULL pointer back (I included also resource.h in the header file)

    What's wrong ?

    Thanx,
    Grit


  2. #2
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: disable MenuItems in CDialog

    Did you try EnableMenu function of class CMenu?

    Let me know if this help u
    Regards,
    Ovidiu


  3. #3
    Join Date
    Jun 1999
    Posts
    319

    Re: disable MenuItems in CDialog

    Add a WM_UPDATE_COMMAND mesage for your item ID.
    In the implementation add this pCMDUI->Enable(FALSE);
    Let me know if this helps you.
    Best regards,
    Faby


  4. #4
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: disable MenuItems in CDialog

    Look some detalied code

    CMenu m_Menu;
    m_Menu.LoadMenu( IDR_MAINFRAME );
    CMenu* pMenu = m_Menu.GetSubMenu( 0 );
    pMenu->EnableMenuItem( ID__EDIT, MF_DISABLED | MF_GRAYED );




    Regards,
    Ovidiu



  5. #5
    Join Date
    May 1999
    Location
    Spain
    Posts
    335

    Re: disable MenuItems in CDialog

    Have you tried to override the OnUpdateCommandUI, and the set to false the enable ?

    HTH, Bye !
    Braulio


  6. #6
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: disable MenuItems in CDialog - it works

    Hi,

    thank you, it works perfect !!!!!!!!!!!!1

    Grit


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