就是如何用鼠标点击List的一条状态出现一个竖条菜单栏,里面有删除、说明啥的,类似于右键点击WIN桌面出现的那个。。这个怎么完成?求帮组啊!!

解决方案 »

  1.   

    响应WM_CONTEXTMENU消息,在这个消息里:
    void CSingleBattView::OnContextMenu(CWnd* pWnd, CPoint point) 
    {
    if (point.x == -1 && point.y == -1)
    {
    //keystroke invocation
    CRect rect;
    GetClientRect(rect);
    ClientToScreen(rect); point = rect.TopLeft();
    point.Offset(5, 5);
    } CMenu menu;
    VERIFY(menu.LoadMenu(IDR_POPUPMENU));//在资源管理器里自己加的菜单 CMenu* pPopup = menu.GetSubMenu(0);
    ASSERT(pPopup != NULL);
    CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD)
    pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
    pWndPopupOwner);
    }