关于 VC++ 小的问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 19:30:02
CRgn rgn;
RECT rect;
rect.left=0;
rect.top=0;
rect.right=500;
rect.bottom=100;
rgn.CreateEllipticRgnIndirect(&rect);
SetWindowRgn(rgn,TRUE);
这个是一个创建圆形窗口的代码,问题如下,
int SetWindowRgn( HRGN hRgn, BOOL bRedraw );这个是函数原型,第一参数需要的是一个HRGN的句柄,为什么传递一个对象,也可以呢,小弟,很久没有看书了,忘记了是为什么了。
在线等!!!!!

CRgn里面有个CRgn::operator HRGN。返回1个CRgn的句柄。

MSDN里是这样描述的:
This operator is a casting operator, which supports direct use of an HRGN object.

我自己的翻译是:这个操作是一个构造操作,它支持直接使用HRGN对象。

英语学的不好,不知道翻译的对不对。

本函数的全问是
int SetWindowRgn(
HWND hWnd, // handle to window
HRGN hRgn, // handle to region
BOOL bRedraw // window redraw option
);
Parameters
hWnd
[in] Handle to the window whose window region is to be set.
hRgn
[in] Handle to a region. The function sets the window region of the window to this region.
If hRgn is NULL, the function sets the window region to NULL.

bRedraw
[in] Specifies whether the system redraws the window after setting the window region. If bRedraw is TRUE, the system does so; otherwise, it does not.
Typically, you set bRedraw to TRUE if the window is visible.
我用金山词霸翻译后是第二个参数是一个表示范围的句柄

有一阵子没有编程序了
应该有另一个原型,第一参数是对象
这是C++的重载