UINT SetTimer(
HWND hWnd, // handle of window for timer messages
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
);自己新建一个.cpp文件,里面需用到定时器,当定时时间到时去执行相应的函数:
HWND m_hWnd;
SetTimer(m_hWnd,1,Sec,AfxBeginThread(con_RecvThread, &concentrator));
其中AfxBeginThread(con_RecvThread, &concentrator)是当定时到时,所要执行的函数,它在另一个.cpp中。请问m_hWnd是什么?我应该怎样获得? 我现在的错误是:error C2660: 'SetTimer' : function does not take 4 parameters执行 cl.exe 时出错. 请高手指点呀!
HWND hWnd, // handle of window for timer messages
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
);自己新建一个.cpp文件,里面需用到定时器,当定时时间到时去执行相应的函数:
HWND m_hWnd;
SetTimer(m_hWnd,1,Sec,AfxBeginThread(con_RecvThread, &concentrator));
其中AfxBeginThread(con_RecvThread, &concentrator)是当定时到时,所要执行的函数,它在另一个.cpp中。请问m_hWnd是什么?我应该怎样获得? 我现在的错误是:error C2660: 'SetTimer' : function does not take 4 parameters执行 cl.exe 时出错. 请高手指点呀!
如果是对话框类中就不需要第一个参数的句柄如果楼主是用VS系列的编译器,可以看一下智能提示,有多少个参数,一般设置定时器是这样使用的: // 启动定时器
SetTimer( 2 , 1000 , NULL );
http://msdn.microsoft.com/en-us/library/49313fdf(v=vs.80).aspx
直接用
SetTimer(1,Sec,AfxBeginThread);
不过函数AfxBeginThread的原型不对,应该是VOID CALLBACK TimerProc(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
);