简体   繁体   English

检查计时器是否已经启动

[英]Check if the timer is already started

How do I know if the timer is running or already started?我如何知道计时器是否正在运行或已经启动? Without waiting the time is elapsed?不等待时间就过去了?

UINT_PTR nID = SetTimer(123, 60x1000, NULL);  // Info after 1 Min.
bool bTimerStarted = false;     // do I need this bool var to check the state of the timer? 
if (nID == 123)
   bTimerStarted = true;

  

You cannot.你不能。 There is no API to query whether any given timer exists, without also resetting that timer (which SetTimer can do).没有 API 可以查询是否存在任何给定的计时器,而无需重置该计时器( SetTimer可以这样做)。

Then again, I cannot think of a situation where this would be required.再说一次,我想不出需要这样做的情况。 Unless you've designed yourself into a corner previously.除非你以前把自己设计成一个角落。 In that case, solve the architectural issue, and you'll find that you won't need this information either.在这种情况下,解决架构问题,您会发现您也不需要这些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM