是否能够在OnTimer()内重新设定定时器的时间,我该如何做?

解决方案 »

  1.   

    本来你是1秒一次
    SetTimer(1,1000,NULL);
    OnTimer()
    {
    //达到条件就设成0.5秒一次
    if(...)
       SetTimer(1,500,NULL);
    }
      

  2.   

    我没有试过,但我想shilong(星矢の诗龙)的方法应该行不能,
    正确的应该是:
    本来你是1秒一次
    SetTimer(1,1000,NULL);
    OnTimer()
    {
    //达到条件就设成0.5秒一次
    if(...)
    {
     KillTimer(1) 
       SetTimer(1,500,NULL);
    }
    }
      

  3.   

    KillTimer();
    SetTimer();
    就可以了。
      

  4.   

    在OnTimer中用同一个Timer的ID调用SetTimer,就可以重新更改设置,就象楼上所说
      

  5.   

    看看MSDN中是怎么说的吧:
    Applications create timers by using the SetTimer function. A new timer starts timing the interval as soon as it is created. An application can change a timer's time-out value by using SetTimer and can destroy a timer by using the KillTimer function. To use system resources efficiently, applications should destroy timers that are no longer necessary. 
      

  6.   

    我指的是shilong(星矢の诗龙)的回复