转自:https://wenku.baidu.com/view/f261330f83c4bb4cf6ecd109.html
BOOL CTestDlg::ContinueModal()
{if (m_toolBar.IsWindowVisible())
{
m_toolBar.OnUpdateCmdUI((CFrameWnd*)this, TRUE);
}
CCmdUI cmdUI;
cmdUI.m_pParentMenu = GetMenu();
if (NULL != cmdUI.m_pParentMenu)
{
for (UINT ui(0); ui < cmdUI.m_pParentMenu->GetMenuItemCount() ; ++ui)
{
cmdUI.m_pMenu = cmdUI.m_pParentMenu->GetSubMenu(ui);
cmdUI.m_nIndexMax = cmdUI.m_pMenu->GetMenuItemCount();
for (UINT uIndex(0); uIndex < cmdUI.m_nIndexMax; ++uIndex)
{
cmdUI.m_nID = cmdUI.m_pMenu->GetMenuItemID(uIndex);
cmdUI.m_nIndex = uIndex;
cmdUI.DoUpdate(this, TRUE);
}
}
}
return CDialog::ContinueModal();
}