开发者

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

开发者 https://www.devze.com 2022-12-18 10:28 出处:网络
How开发者_JS百科 to create timer in WinApi (C++)?Call the SetTimer function.This allows you to specify a callback function, or to have Windows post you a WM_TIMER message.You cannot not know this if y

How开发者_JS百科 to create timer in WinApi (C++)?


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


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


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


A Good Example for CreateTimerQueueTimer : Here

Another is HERE


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号