我设的定时器为什么没有用呀
LRESULT CALLBACK WinSunProc(HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
PAINTSTRUCT ps;
HDC hdc;
static HICON Speople, Apoint, Bpoint;
static POINT people;
Speople=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON3));
Apoint=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1));
Bpoint=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON2));
switch(uMsg)
{
case WM_CREATE:
{
people.x=23;
people.y=23;
}
break;
case WM_PAINT:
{
hdc=BeginPaint(hwnd,&ps);
Hdc=BeginPaint(hwnd,&ps);
DrawIcon(hdc,people.x,people.y,Speople);
DrawIcon(hdc,53,23,Apoint);
DrawIcon(hdc,800,23,Bpoint);
while (people.x<=800)
{
people.x=people.x+30;
DrawIcon(hdc,people.x,people.y,Speople);
SetTimer(hwnd,1,1000,NULL);
}
EndPaint(hwnd,&ps);
}
break;
case WM_CLOSE:
KillTimer(hwnd,1);
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
为什么不是间隔1S出来一张图片?怎么一下子全出来了?这是为什么呀?本人菜鸟,求指点!