vc使用SetTimer回调函数

这个就是回调函数了,使用的时候要在头文件中写在类外面,而且要加static,因为操作系统回调的函数都必须是静态的,不能加this指针。


static void CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime);//头文件中定义的

::SetTimer(this-> m_hWnd,1,10,(TIMERPROC)TimerProc);

void CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
{
//你的代码
}

 

转载自http://chaochaoblog.com/archives/899

原文地址:https://www.cnblogs.com/lfzark/p/3644079.html