请问各位:为什么只有选择了一项之后菜单才能关闭?这个问题太烦人了

解决方案 »

  1.   

    你是怎么做的?参考一下我的代码,比较久了,不知道别的地方还要做什么处理
    void CXXXDlg::OnContextMenu(CWnd*, CPoint point)
    { // CG: This block was added by the Pop-up Menu component
    {
    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(CG_IDR_POPUP_XXXDLG)); 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);
    }
    }
      

  2.   

    到www.vckbase.com上去看电子杂志
    有一期讲这个主题,很详细
      

  3.   

    在菜单弹出之前调用SetForegroundWindow();