#include <windows.h>
#include <stdio.h>
HANDLE hTimer;
int i = 0;
void CALLBACK fun(HWND, unsigned int, unsigned int, unsigned long)
{
i+=1;
printf("%d ",i);
return;
}
int main(int argc, char* argv[])
{
UINT k = SetTimer(NULL,1,1000,fun);
printf("%d/n", k);
MSG msg;
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (5 == i)
{
KillTimer(NULL,k);
break;
}
}
return 0;
}