=========================ScrollWindow原型========================
BOOL ScrollWindow(
HWND hWnd,
int XAmount,
int YAmount,
const RECT *lpRect,
const RECT *lpClipRect
);
参数:
xAmount 指定了水平滚动的量,使用设备单位。在左滚时,该参数必须为负。 yAmount 指定了垂直滚动的量,使用设备单位。在上滚时,该参数必须为负。
lpRect 指向一个RECT结构,指定了要滚动的客户区的部分。假如lpRect为NULL,则将滚动整个客户区。假如光标区域与滚动矩形重叠,则插字符将被重定位。
lpClipRect 指向一个RECT结构,指定了要滚动的裁剪区域。只有这个矩形中的位才会被滚动。在矩形之外的位不会被影响,即使它们是在lpRect矩形之内。(见代码"测试一")假如lpClipRect为NULL,则不会在滚动矩形上进行裁剪。(见代码"测试二")
综上,一般将lpRect和lpClipRect指向同一个RECT。(见代码"测试三")
================================我的测试程序================================
#include
<
windows.h
>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE yY,PSTR szCmdLine, int iCmdShow)
{
static TCHAR szWndClassName[] = TEXT( " yy " );
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = CreateSolidBrush ( RGB( 212 , 208 , 200 ) ) ;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szWndClassName;
if ( ! RegisterClass( & wndclass)){
MessageBox(NULL,TEXT( " This program requires Windows NT! " ),szWndClass
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE yY,PSTR szCmdLine, int iCmdShow)
{
static TCHAR szWndClassName[] = TEXT( " yy " );
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = CreateSolidBrush ( RGB( 212 , 208 , 200 ) ) ;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szWndClassName;
if ( ! RegisterClass( & wndclass)){
MessageBox(NULL,TEXT( " This program requires Windows NT! " ),szWndClass