Hi Tech-Support,
In our company product, we create some customize menuitems with CExtPopupMenuWnd in OnExtMenuPrepare(), The code is like as below :
CExtPopupMenuWnd::MsgPrepareMenuData_t *pData = reinterpret_cast < CExtPopupMenuWnd::MsgPrepareMenuData_t *> (wParam);
ASSERT(pData != NULL);
CExtPopupMenuWnd *pPopup = pData->m_pPopup;
ASSERT(pPopup != NULL);
INT nItemPos = 0;
INT nNewPos = -1;
if (m_uLocatePosId != 0) //m_uLocatePosId is a special insert position
{
nItemPos = pPopup->ItemFindPosForCmdID(m_uLocatePosId);
if (nItemPos > 0)
{
nNewPos = nItemPos;
}
if (nNewPos > 0)
{
VERIFY(g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, IDR_XX_MENU);
if (pPopup->ItemGetCount() - 1 <= nNewPos || pPopup->ItemGetPopup(nNewPos) == NULL)
{
CExtPopupMenuWnd* pXXMenu = new CEXtPopupMenuWnd();
pXXMenu->LoadMenu(this->GetSafeWnd(), IDR_XX_MENU);
char buf[MAX_SIZE] = "\0";
LoadString(GetAppFrameInstance(), IDS_XX_MENU, buf, MAX_SIZE);
VERIFY(pPopup->ItemInsertSpecPopup(pXXMenu, nNewPos+1, buf));
}
}
The problem is when I click the menuitem, I can’t see the check status of the menuitem. (I have implemented the OnUpdateMenu for the menuitem)
The OnUpdateMenu is like as below:
void CXXWnd::OnUpdateMenu(CCmdUI* pCmdUI)
{
pCmdUI->Enable();
pCmdUI->SetCheck(m_bChecked);
}
I would appreciate it if you can give me some help.