Menu操作

来源:互联网 发布:老司机软件 编辑:程序博客网 时间:2024/05/28 01:35

PopMenu

void CTransferAgentAccountDlg::OnRclickListAgentAc(NMHDR* pNMHDR, LRESULT* pResult)
{
    POSITION pos;
    CMenu popmenu, *psubMenu = NULL;
    CPoint oPoint;
    pos = m_ListAgent.GetFirstSelectedItemPosition();
    if(!pos)
    {
        return;
    }
    GetCursorPos( &oPoint);
    popmenu.LoadMenu(IDR_MENU_AGENT);
    psubMenu = popmenu.GetSubMenu(0);
    psubMenu->TrackPopupMenu(TPM_LEFTALIGN, oPoint.x, oPoint.y, this);
    *pResult = 0;
}

delete menu

psubMenu->DeleteMenu(ID_MEMU_FIFO_IB_ADD, MF_GRAYED);
psubMenu->DeleteMenu(ID_MEMU_FIFO_IB_DELETE, MF_GRAYED);
psubMenu->DeleteMenu(ID_MEMU_FIFO_IB_EDIT, MF_GRAYED);

 

enable menu

psubMenu->EnableMenuItem(ID_MEMU_FIFO_IB_VIEW, MF_GRAYED);