创建动态菜单
8. 创建动态菜单
void CMainFrame::OnSelectState(NMTOOLBAR* pnmtb, LRESULT *plr)
{
"CMenu menu;
"if(!menu.CreateMenu())
"return;
"menu.AppendMenu(MF_STRING,0,"开始");
"menu.AppendMenu(MF_STRING,0,"结束");
"CRect rc;
"m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
"m_wndToolBar.ClientToScreen(&rc);
"menu.TrackMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL,
"""rc.left, rc.bottom, this, &rc);
//"menu.DestroyMenu();
"menu.detach();
}
void CMainFrame::OnSelectState(NMTOOLBAR* pnmtb, LRESULT *plr)
{
"CMenu menu;
"if(!menu.CreateMenu())
"return;
"menu.AppendMenu(MF_STRING,0,"开始");
"menu.AppendMenu(MF_STRING,0,"结束");
"CRect rc;
"m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
"m_wndToolBar.ClientToScreen(&rc);
"menu.TrackMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL,
"""rc.left, rc.bottom, this, &rc);
//"menu.DestroyMenu();
"menu.detach();
}
上一篇:std::find,std::find_if使用小结
下一篇:MFC Telnet Application(mfc telnet 端口,代码实现、不调用telnet.exe)