|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2014-5-10 09:36:58
|
显示全部楼层
做了一个简单的定时器控制测试的,
只有第二个定时器起作用。
按下Start显示定时器1
按下Stop显示定时器2
实际只显示 定时器2
void CTimetestDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
switch (nIDEvent)
{
case 1:
{
//m_display.SetSel(0,-1); //选上所有内容
m_display.ReplaceSel(" 定时器1 "); //显示编辑框2内容
KillTimer(1);
}
case 2:
{
m_display.SetSel(0,-1); //选上所有内容
m_display.ReplaceSel("定时器2 "); //显示编辑框2内容
KillTimer(2);
}
break;
}
CDialog::OnTimer(nIDEvent);
}
void CTimetestDlg::OnClear()
{
// TODO: Add your control notification handler code here
m_display.SetSel(0,-1); //选上所有内容
m_display.ReplaceSel(""); //显示编辑框2内容
}
void CTimetestDlg::OnStart()
{
// TODO: Add your control notification handler code here
SetTimer(1,3000,NULL); //等待3秒
}
void CTimetestDlg::OnStop()
{
// TODO: Add your control notification handler code here
SetTimer(2,5000,NULL); //等待5秒
}
void CTimetestDlg::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
|
|