当你鼠标右键单击时的位置point(-1,-1)时
是鼠标的位置移到point(5,5)处

解决方案 »

  1.   

    完整代码:
    void CMainFrame::OnContextMenu(CWnd*, CPoint point){
    if (point.x == -1 && point.y == -1){
    CRect rect;
    GetClientRect(rect);
    ClientToScreen(rect);
    point = rect.TopLeft();
    point.Offset(5, 5);
    }
    CMenu menu;
    VERIFY(menu.LoadMenu(CG_IDR_POPUP_MAIN_FRAME));
    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.   

    point(-1,-1)就是屏幕坐标,在一般情况下鼠标是不会移到这个点上的,但是通过设置是可以让鼠标移到这点上的!
      

  3.   

    cool29,能否讲得再详细点?在线等待!!!!
      

  4.   

    cool29,能否讲得再详细点?在线等待!!!!
      

  5.   

    问题是我也不知道用什么方法才能使鼠标移到point(-1,-1);能不能把整个程序发过来让我看看![email protected]
      

  6.   

    这只是为了安全起见! 没什么别的意思!
    windows为了稳定,设了很多冗余措施!ok!http://www.csdn.net/cnshare/soft/10/10423.shtm