鱼C论坛

 找回密码
 立即注册
查看: 3008|回复: 2

一定要帮我解决啊。。。

[复制链接]
发表于 2012-7-20 21:21:23 | 显示全部楼层 |阅读模式
1鱼币
GetClientRect(hwnd,&rect)
在WM_PAINT这个消息里面调用了上面那个函数。并且传递了实例句柄和RECT结构体的变量给这个函数。   

我的问题是,这个函数调用完成后rect这个变量的属性会发生什么变化。会变成什么?还有,把hwnd传给这个函数是为了什么?

小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-7-20 22:45:05 | 显示全部楼层
RECT结构有四个LONG字段,分别为left、top、right和bottom。GetClientRect将这四个字段设定为窗口显示区域的尺寸。left和top字段通常设定为0。right和bottom字段设定为显示区域的宽度和高度(像素点数)。 也可以是一个CRrect对象指针。CRect对象有多个参数,与RECT用法相同...

另外 你的 hwnd  这个参数是窗口句柄,你的函数的功能是获取窗口客户区坐标,  那么既然是窗口,当然要窗口句柄了。。这个有什么好质疑的?  hwnd是窗口句柄,可以通过FindWindow 函数获取。。。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2012-7-21 07:50:20 | 显示全部楼层
看MSDN:
CWnd::GetClientRect  
void GetClientRect( LPRECT lpRect ) const;

Parameters

lpRect

Points to a RECT structure or a CRect object to receive the client coordinates. The left and top members will be 0. The right and bottom members will contain the width and height of the window.

Remarks

Copies the client coordinates of the CWnd client area into the structure pointed to by lpRect. The client coordinates specify the upper-left and lower-right corners of the client area. Since client coordinates are relative to the upper-left corners of the CWnd client area, the coordinates of the upper-left corner are (0,0).
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-14 05:53

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表