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
Re: disable MenuItems in CDialog
Did you try EnableMenu function of class CMenu?
Let me know if this help u
Regards,
Ovidiu
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
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
Re: disable MenuItems in CDialog
Have you tried to override the OnUpdateCommandUI, and the set to false the enable ?
HTH, Bye !
Braulio
Re: disable MenuItems in CDialog - it works
Hi,
thank you, it works perfect !!!!!!!!!!!!1
Grit