settimer函数的使用
wil 2003-04-24 05:10:25 我写了一个关于settimer函数的小程序,运行的时候没有执行settimer函数中指定的回调函数,具体出错在什么地方,请指教。
代码如下:
#include <iostream.h>
#include <windows.h> /* For the CreateThread prototype */
int count=0;
VOID CALLBACK timer(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
{
cout<<"hello "<<count++<<endl;
return ;
}
void main()
{
int a;
cout<<"intput a integer"<<endl;
int send=SetTimer(NULL,0,3000,(TIMERPROC)timer);
if(send)
cout<<"success"<<send<<endl;
KillTimer(NULL,send);
cin>>a;
}