1、定义定时器ID
#define IDTIMER1 1
2、Override OnTimer方法:
void CHouseRobotDlg::OnTimer(UINT nIDEvent){ switch(nIDEvent) { case IDTIMER1: updateTimeElapsed(); break; default: break; }}
3、需要启动定时器时:
SetTimer(IDTIMER1, 1000, 0);
4、需要停止定时器时:
KillTimer(IDTIMER1);