Click to See Complete Forum and Search --> : disable MenuItems in CDialog


Grit
August 24th, 1999, 06:48 AM
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

Burlacu Ovidiu
August 24th, 1999, 06:55 AM
Did you try EnableMenu function of class CMenu?

Let me know if this help u
Regards,
Ovidiu

Fabi Pantera
August 24th, 1999, 06:57 AM
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

Burlacu Ovidiu
August 24th, 1999, 07:00 AM
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

Braulio
August 24th, 1999, 08:07 AM
Have you tried to override the OnUpdateCommandUI, and the set to false the enable ?

HTH, Bye !
Braulio

Grit
August 24th, 1999, 12:54 PM
Hi,

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

Grit