SetTimer该怎么使用啊,我在CDialog派生的类中使用没有问题,但是在CWnd派生的类中有问题,SetTimer明明是在CWnd中定义的啊。我在debug版本中出现debug assertion failed,但是在release版本中没有问题.这是什么原因啊?

解决方案 »

  1.   

    In the Release version of MFC, ASSERT does not evaluate the expression and thus will not interrupt the program. If the expression must be evaluated regardless of environment, use the VERIFY macro in place of ASSERT.
      

  2.   

    ASSERT宏在debug版本中有用,主要为了方便调试,而在release版本中ASSERT宏失效;
    在CWnd派生的类中使用定时器是没有问题的,CDialong也是从CWnd派生而来的,所以可以重载SetTimer函数,你再检查一下,可能是别的方面的问题
      

  3.   

    很可能的出错原因是你在窗口没有创建之前调用了SetTimer.找个适当的时候(一定在窗口创建之后)再调用Settimer