RECT、LPRECT定义如下:
typedef struct tagRECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
在使用的过程中,如果是LPRECT型作输入参数的话。一般来说可能会这样做,如下:
LPRECT lpRect;
lpRect->left = 0; // ㈠
lpRect->right = 1024;
lpRect->top =0;
lpRect->bottom = 768;
CopyToClip(hWnd,lpRect); //
程序在编译时没有错误,只有个警告 warning C4700: local variable 'lpRect' used without having been initialized.这个警告另我摸不着头脑。有谁能弄明白请指教一下在下。当程序执行到此处时中断了。
正确的做法是:
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = 1024;
rect.bottom = 768;
CopyToClip(hWnd,&rect);
这两段代码还是有些差距的。
我不明白为什么样要这样定义这个结构:
typedef struct tagRECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
定义成这样有什么好处呢?