如何在 WinApi (C++) 中创建计时器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2128620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 22:11:46 来源:igfitidea点击:
How to create timer in WinApi (C++)?
提问by SomeUser
How to create timer in WinApi (C++)?
如何在 WinApi (C++) 中创建计时器?
回答by itowlson
回答by Hans Passant
You cannot not know this if you write GUI code. Which makes it likely you want to use CreateTimerQueueTimer().
如果您编写 GUI 代码,您不可能不知道这一点。这使得您很可能想要使用 CreateTimerQueueTimer()。
回答by Swanand
回答by John Knoeller
回答by sankar
call the setTimer()
Function. Suppose I called
调用setTimer()
函数。假设我打电话
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;