首先用VS2008建立基于对话框的程序 一、开启定时器 SetTimer(1, 1000, NULL); // 启动定时器1,定时时间默认1秒 SetTimer(2, 2000, NULL); // 启动定时器2,定时时间默认2秒 SetTimer(3, 3000, NULL); // 启动定时器3,定时时间默认3秒 二、设置触发事件 重载WM_TIMER消息 void CTestDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调用默认值 switch(nIDEvent) { case 1: { func1(); // 定时器1触发事件 } case 2: { func2(); // 定时器2触发事件 } case 3: { func3(); // 定时器3触发事件 } } CDialog::OnTimer(nIDEvent); } 三、关闭定时器 KillTimer(1); // 关闭定时器1 KillTimer(2); // 关闭定时器2 KillTimer(3); // 关闭定时器3