Esempio n. 1
0
BOOL CPopupFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
{
	if (m_pMenu != NULL && pHandlerInfo == NULL)
	{
		if (nCode == CN_COMMAND)
		{
			if (m_pMenu->SelectItem(nID) == S_OK)
				return TRUE;			
		}
		else if (nCode == CN_UPDATE_COMMAND_UI)
		{
			CCmdUI* pCmdUI = (CCmdUI*)pExtra;

			long lState;
			if (m_pMenu->GetItemState(pCmdUI->m_nID, &lState) == S_OK)
			{
				pCmdUI->Enable((lState & MenuStateDisable) == 0);
				pCmdUI->SetCheck((lState & MenuStateCheck) != 0);
				
				return TRUE;
			}
		}	
	}
	
	return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
Esempio n. 2
0
LRESULT CPIMDIFrameWndEx::OnUICheckEvent(WPARAM wParam, LPARAM lParam)
{
	CCmdUI* pCmdUI = (CCmdUI*)wParam;
	ASSERT(pCmdUI != NULL);

	BOOL bCheck = (BOOL)lParam;
	pCmdUI->SetCheck(bCheck);

	return 0;
}