Hi at all,
i have a SDI Applikation made by MFC. I want to change the check status of one Menu Item.
Ho can I do that?
I´ve tried this:
Adding the Command Event Handler
This doesn´t work.Code:void MyClass::CommandHandler() { MENUITEMINFOW mItemInfo; CWnd* pMainWnd = AfxGetMainWnd(); CMenu *mMenu = pMainWnd->GetMenu(); CMenu *mSubMenu = mMenu->GetSubMenu(0); mSubMenu->GetMenuItemInfo(ID_CONFIGURE_SETTOFOREGROUNDININCOMINGCALL, &mItemInfo); if(mItemInfo.fState == MF_CHECKED) { mSubMenu->CheckMenuItem(ID_CONFIGURE_SETTOFOREGROUNDININCOMINGCALL, MF_UNCHECKED); m_bSetForeground = false; } else if(mItemInfo.fState == MF_UNCHECKED) { mSubMenu->CheckMenuItem(ID_CONFIGURE_SETTOFOREGROUNDININCOMINGCALL, MF_CHECKED); m_bSetForeground = true; } }
Is there a way to do it with the ON_UPDATE_COMMAND_UI?
But I don´t know how I can get the state of the menu item entry and if I do it with this handler
everytime since I click the Menuheader without clicking the wanted item the function will be executed and I can´t find out how to catch only if i click my item.
Regards
Karsten




Reply With Quote