解决方案 »

  1.   

    把OnLButtonDown的参数point(UINT nFlags, CPoint point) 保存起来,然后在OnKeyDown中SetCursorPos(point.x,point.y);
      

  2.   

    不知道用什么方法把point保存
      

  3.   

    在CEXAMPLEView类中添加一个成员变量 CPoint m_point;在OnLButtonDown函数中为其赋值m_point = point;然后在OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 函数中使用m_point不就可以了吗,还是我没看懂问题???
      

  4.   

    void CEXAMPLEView::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default
    CClientDC dc(this);
    dc.TextOut(point.x,point.y,"Hello",strlen("Hello"));
    m_Point=point;//  定义到 h 中 : CPoint m_Point
    CView::OnLButtonDown(nFlags, point);
    }void CEXAMPLEView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
    {
    // TODO: Add your message handler code here and/or call defaultif (nChar=='m'||nChar=='M')
    {
    SetCursorPos(m_Point.x,m_Point.Y);
    }
    CView::OnKeyDown(nChar, nRepCnt, nFlags);
    }