如何得到窗体的大小及宽高。

解决方案 »

  1.   

    void GetClientRect( LPRECT lpRect ) const;
      

  2.   

    我的程序是基于对话框的,我要取的是窗口的大小及宽高,好像不是GetwindowRect吧。如果要把窗口的右上角的关闭按钮变灰色(不起作用),请问应该怎样搞。
      

  3.   

    是GetWindowRect()
    把窗口的右上角的关闭按钮变灰色:
    可以在DefWindowProc或PreTranslateMessage,中截获WM_CLOSE消息
      

  4.   

    int nXScreen=GetSystemMetrics(SM_CXSCREEN);
    int nYScreen=GetSystemMetrics(SM_CYSCREEN);
    CRect WinRect;
    GetWindowRect(WinRect);
    MoveWindow( nXScreen-WinRect.Width()-10, nYScreen/2-WinRect.Height()/2 ,WinRect.Width(), WinRect.Height(),FALSE );
    为什么不是:GetWindowRect()?
      

  5.   

    GetClientRect( LPRECT lpRect ) const;取是客户区,而不是窗口体的。
    GetWindowRect()才是吧。