可以利用GetWindowRect函数获得相对于整个窗口的坐标。

解决方案 »

  1.   

    GetWindowRect得到的是整个窗口,包括标题栏的矩形区域,我想得到的是窗口的客户区的矩形区域的屏幕坐标.GetClientRect函数是不行的,它得到的是举行区域的大小.rect.Left,rect.Top都是0
      

  2.   

    Get the window's caption and frame width via GetSystemMetrics function.
      

  3.   


    ClientToScreen(HWND hWnd,LPPOINT lpPoint);

    GetWindowRect();
      

  4.   

    问题解决了
    void CGetClientPosDlg::OnOK() 
    {
    // TODO: Add extra validation here
    CRect rect;
    GetClientRect(&rect);
    ClientToScreen(&rect);
    CString str;
    str.Format("%d,%d,%d,%d",
                       rect.left,rect.top,rect.right,rect.bottom); 
    AfxMessageBox(str); //CDialog::OnOK();
    }
    wxz是对的