+ -
当前位置:首页 → 问答吧 → GetClientRect和GetWindowRect

GetClientRect和GetWindowRect

时间:2011-12-18

来源:互联网

为什么我用这两个函数任何一个获取的矩形的top和bottom永远是相等 GetClientRect top bottom一直是0,0 GetWindowRect也一直是相等的。

作者: qr19880830   发布时间: 2011-12-18

C/C++ code
BOOL GetClientRect(          HWND hWnd,
    LPRECT lpRect
);
Parameters

hWnd
[in] Handle to the window whose client coordinates are to be retrieved. 
lpRect
[out] Pointer to a RECT structure that receives the client coordinates. The left and top members are zero. The right and bottom members contain the width and height of the window. 


C/C++ code

BOOL GetWindowRect(          HWND hWnd,
    LPRECT lpRect
);
Parameters

hWnd
[in] Handle to the window. 
lpRect
[out] Pointer to a structure that receives the screen coordinates of the upper-left and lower-right corners of the window. 

作者: VisualEleven   发布时间: 2011-12-18

贴代码看看?

作者: agoago_2009   发布时间: 2011-12-18

我写在初始化函数里了

作者: qr19880830   发布时间: 2011-12-18

引用 3 楼 qr19880830 的回复:

我写在初始化函数里了

在你的窗口初始化函数中PostMessage一个自定义消息,在自定义消息的响应函数中GetClientRect/GetWindowRect()即可。

作者: VisualEleven   发布时间: 2011-12-18