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:
A Good Example for CreateTimerQueueTimer : Here
Another is HERE
回答4:
SetTimer. A window handle is needed, and the timer will not be delivered if you aren't pumping messages.
回答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;