开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜