void CDSCAMDEMODlg::OnUpdateToolWash(CCmdUI* pCmdUI)
{
CToolBarCtrl& tbc = m_mainToolbar.GetToolBarCtrl();
if(g_wash){ // 标记菜单、工具按钮是否是选中状态
pCmdUI->SetCheck(true);
tbc.CheckButton(ID_WASH,true);
}
else{
pCmdUI->SetCheck(FALSE);
tbc.CheckButton(ID_WASH,FALSE);
}
}
相关方法:
菜单无法响应OnUpdate***时用virtual:ContinueModal(),代码如下:
BOOL CDSCAMDEMODlg::ContinueModal()
{
// TODO: 在此添加专用代码和/或调用基类
CMenu* pMainMenu = GetMenu();
CCmdUI cmdUI;
for (UINT n = 0; n < (pMainMenu->GetMenuItemCount()); ++n)
{
CMenu* pSubMenu = pMainMenu-> GetSubMenu(n);
cmdUI.m_nIndexMax = pSubMenu-> GetMenuItemCount();
for (UINT i = 0; i < cmdUI.m_nIndexMax;++i)
{
cmdUI.m_nIndex = i;
cmdUI.m_nID = pSubMenu-> GetMenuItemID(i);
cmdUI.m_pMenu = pSubMenu;
cmdUI.DoUpdate(this, FALSE);
}
}
return CDialog::ContinueModal();
}