一。定时器
1.在onCreate处理函数中添加定时器
1 //1 定时器id 2 //500 时间间隔 500ms 3 //NULL 使用系统默认处理函数 500ms触发一次VM_TIMER 4 SetTimer(1, 500, NULL);
2.添加VM_TIMER消息处理函数
1 void CMFCApplication2View::OnTimer(UINT_PTR nIDEvent) 2 { 3 // TODO: 在此添加消息处理程序代码和/或调用默认值 4 if (nIDEvent == 1) //定时器id,从而每个定时器有不同的处理函数 5 { 6 static int i = 0; 7 i++; 8 CString str; 9 str.Format(TEXT("%d"), i); 10 MessageBox(str); 11 CView::OnTimer(nIDEvent); 12 } 13 }
原文:https://www.cnblogs.com/sclu/p/11558837.html