差不多是这样了,你自己再试试,修改修改,有些对象自己定义一下。case WM_RBUTTONDOWN:                       //收到右键消息   
       POINT curPos;          
       GetCursorPos(&curPos);               //得到鼠标位置
       pSubMenu=MyPopupMenu.GetSubMenu(0);  
       pSubMenu->TrackPopupMenuTPM_LEFTALIGN
                   |TPM_LEFTBUTTON,curPos.x,curPos.y,this);//弹出菜单

解决方案 »

  1.   

    #define IDM_ITEM0 10 
    #define IDM_ITEM1 11 
    #define IDM_ITEM2 12 
    #define IDM_ITEM3 13 
    #define IDM_ITEM4 14 
    #define IDM_ITEM5 15 
    #define IDM_ITEM6 16 
    CMyWnd::CMyWnd() 

    //CMyWnd是从CWnd派生来的。 
    //先把菜单创建起来。 
    MyMenu2=new CMenu; 
    MyMenu2->CreatePopupMenu(); 
    MyMenu2->AppendMenu(MF_STRING,IDM_ITEM0,"拷贝"); 
    MyMenu2->AppendMenu(MF_STRING,IDM_ITEM1,"剪切"); 
    MyMenu2->AppendMenu(MF_STRING,IDM_ITEM2,"粘贴"); 
    MyMenu2->AppendMenu(MF_SEPARATOR,IDM_ITEM3,""); 
    MyMenu2->AppendMenu(MF_STRING,IDM_ITEM4,"全选"); 
    MyMenu2->AppendMenu(MF_SEPARATOR,IDM_ITEM3,""); 
    MyMenu2->AppendMenu(MF_STRING,IDM_ITEM5,"删除"); } 
    CMyWnd::~CMyWnd() 

    MyMenu2->DestroyMenu();//销毁菜单所占用的系统资源 
    delete MyMenu2;//销毁菜单类对象 

    void CMyWnd::OnRButtonDown(UINT nFlags, CPoint point) 

    RECT rect; 
    GetWindowRect(&rect); 
    //显示菜单 
    MyMenu2->TrackPopupMenu(TPM_RIGHTALIGN,point.x+rect.left,point.y+ 
    rect.top,this,NULL); 

      

  2.   

    void CUABView::OnContextMenu(CWnd* pWnd, CPoint point) 
    {
    // TODO: Add your message handler code here
    CMenu menu;
    CMenu *ptrMenu;
    CPoint pointDev=point;

    menu.LoadMenu(IDR_MENU_RIGHT_POP);
    ptrMenu=menu.GetSubMenu(0);
    ptrMenu->TrackPopupMenu
    (
    TPM_LEFTALIGN|TPM_RIGHTBUTTON,
    point.x,
    point.y,
    this,
    NULL
    );
    }