How to Use MFC SetTimer

这是一个在MFC中使用Timer的示例:

1) 设定Timer

In OnInitDialog():

UINT time_result = SetTimer(1, 50, 0);

Timer的ID是1. 间隔是50ms.

2) 处理Timer事件

在OnTimer(UINT nIDEvent)函数中处理事件.

3) 程序退出时销毁设定的Timer.

In OnDestroy():

KillTimer(1);

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *