最好返回是CPoint类型的,用例说明函数用法

解决方案 »

  1.   

    利用WINAPI
    BOOL GetCursorPos(
      LPPOINT lpPoint   // 鼠标坐标,相对于屏幕的);
    使用方法
    POINT pt;
    if (GetCursorPos(&pt))
    {
    ...
    }
      

  2.   

    GetCursorPos
    The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
      LPPOINT lpPoint   // address of structure for cursor position
    );
      

  3.   

    GetCursorPos
    The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
      LPPOINT lpPoint   // address of structure for cursor position
    );
      

  4.   

    See the piece of code :
    void CMyView::OnLButtonDown(UINT nFlag, CPoint point)
    {
       //.....
       SetCapture();
       SetCursor(LoadCursor(NULL,IDC_CROSS));
       //....
    }
    void CMyView::OnLButtonDblClk(UINT nFlag, CPoint point)
    {
       //....
       CString InfoString;
       InfoString.Format("X:%d Y:%d,point.x,point.y");
       MessageBox(InfoString);
       //...
    }
      

  5.   

    See the sample below, useful :http://www.codeproject.com/gdi/mousecapture.asp
      

  6.   

    利用WINAPI
    BOOL GetCursorPos(
      LPPOINT lpPoint   // 鼠标坐标,相对于屏幕的);
    使用方法
    POINT pt;
    if (GetCursorPos(&pt))
    {
    ...
    }
      

  7.   

    得到后还要用ScreenToClient()转换为客户区坐标
      

  8.   

    GetCursorPos,可以用 WindowToClient 转换
      

  9.   

    CPoint pt;
    GetCursorPos(&pt);
    ScreenToClient();