Posted on 2008-03-17 17:29
天之骄子 阅读(214)
评论(0) 编辑 收藏 引用
// The code fragment below shows how to use ON_COMMAND_RANGE macro
// to map a contiguous range of command IDs to a single message
// handler function (i.e. OnRangeCmds() in the sample below). In
// addition, it also shows how to use CheckMenuRadioItem() to check a
// selected menu item and makes it a radio item.
//ON_UPDATE_COMMAND_UI_RANGE();
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_COMMAND_RANGE(ID_COMMAND_RANGECMD1, ID_COMMAND_RANGECMD3, &CChildFrame::OnRangeCmds)
END_MESSAGE_MAP()
void CChildFrame::OnRangeCmds(UINT nID)
{
CMenu* mmenu = AfxGetMainWnd()->GetMenu();
CMenu* submenu = mmenu->GetSubMenu(5);
submenu->CheckMenuRadioItem(ID_COMMAND_RANGECMD1, ID_COMMAND_RANGECMD3,
nID, MF_BYCOMMAND);
}