15,979
社区成员
发帖
与我相关
我的任务
分享
SetTimer(1,100,NULL);
SetTimer(2,100,NULL);
OnTimer(nIDEvent)
{
switch(nIDEvent)
{
case 1:
//干什么
break;
case 2:
//干什么
break;
}
}
void CTest_SetTimerDlg::OnButton1()
{
// TODO: Add your control notification handler code here
SetTimer(1,100,NULL);
}
void CTest_SetTimerDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
static int nNum = 0;
static int nNum2 = 0;
if (nIDEvent==1)
{
CString str;
str.Format("%d",nNum);
SetWindowText(str);
Sleep(2000);
nNum++;
}
CString str2;
str2.Format("%d",nNum2);
SetDlgItemText(IDC_BUTTON1,str2);
nNum2++;
CDialog::OnTimer(nIDEvent);
}