How to create timer in WinApi (C++)?

岁酱吖の 提交于 2020-01-09 11:33:08

问题


How to create timer in WinApi (C++)?


回答1:


Call the SetTimer function. This allows you to specify a callback function, or to have Windows post you a WM_TIMER message.




回答2:


You cannot not know this if you write GUI code. Which makes it likely you want to use CreateTimerQueueTimer().




回答3:


SetTimer. A window handle is needed, and the timer will not be delivered if you aren't pumping messages.




回答4:


A Good Example for CreateTimerQueueTimer : Here

Another is HERE




回答5:


call the setTimer() Function. Suppose I called

SetTimer(hWnd,POST_CBIT_TIMER,500,NULL);

Call back function is

UINT nIdEvent ;//global member variable

case WM_TIMER:

if(nIDEvent == POST_CBIT_TIMER)
{

KillTimer(hParent,POST_CBIT_TIMER);


}
break;


来源:https://stackoverflow.com/questions/2128620/how-to-create-timer-in-winapi-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!