Click to See Complete Forum and Search --> : Menu, same question again


October 4th, 1999, 04:38 AM
I wrote the code for check and uncheck the menu in dialog base app,
but it doesn't work.

void CMyDlg::OnEditShow()
{
// TODO: Add your command handler code here
// Do something...
}

void CMyDlg::OnUpdateEditShow(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
if( m_bShow==TRUE )
{
pCmdUI->SetCheck(1);
m_bShow=FALSE;
}
else
{
pCmdUI->SetCheck(0);
m_bShow=TRUE;
}
}




Could anyone tell me how can I check and uncheck the menu in dialog base app?

Thanks in advance.

Fabi Pantera
October 4th, 1999, 07:00 AM
Add this to the command code:
CMenu* pMenu = GetMenu();
pMenu->CheckMenuItem(yourID, MF_BYCOMMAND | MF_CHECKED);

Let me know if this helps you.
Best regards,
Faby

October 4th, 1999, 08:54 AM
Hi Faby,

Thanks for your code, it works.