我想改变一个BUTTON的默认位置!
利用MOVEWINDOW()可以改变!
但是我无法得到按钮的当前坐标,以参照现有位置来进行改变!
我用GetWindowRect()总是有错误!
请问该如何写代码?

解决方案 »

  1.   

    RECT rcButton;
    HWND hButtonWnd = ::GetDlgItem(m_hWnd,IDOK);
    ::GetWindowRect(hButtonWnd,&rcButton);
    CString strButton;
    strButton.Format(_T("left = %d, top = %d, bottom = %d, right = %d"),
                 rcButton.left,rcButton.top,rcButton.bottom,rcButton.right);
    AfxMessageBox(strButton);
      

  2.   

    CRect rt;
    (GetDlgItem(ID_BUTTON))->GetWindowRect(&rt);//ID_BUTTON為你要得到坐標的button的id
      

  3.   

    你用GetWindowPlaceMent()
    就不会错了!