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

2019-01-20 08:34发布

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

标签: c++ winapi timer
5条回答
We Are One
2楼-- · 2019-01-20 08:50

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

查看更多
欢心
3楼-- · 2019-01-20 08:50

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

查看更多
贼婆χ
4楼-- · 2019-01-20 08:56

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

查看更多
该账号已被封号
5楼-- · 2019-01-20 08:56

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;
查看更多
对你真心纯属浪费
6楼-- · 2019-01-20 09:01

A Good Example for CreateTimerQueueTimer : Here

Another is HERE

查看更多
登录 后发表回答