使用如下代码测试:
void CTestDlgDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString str;
MessageBox("123");
str.Format("%d",KillTimer(1));
MessageBox(str);
SetTimer(1,400,NULL);
}
首先在对话框初始化时SetTimer,使用上面的代码,出现的第二个提示对话框值是0,如果把MessageBox("123");
注销掉,则对话框显示0
也就是说KillTimer(1)返回值会因为前面调用了MessageBox函数而不同。
void CTestDlgDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString str;
MessageBox("123");
str.Format("%d",KillTimer(1));
MessageBox(str);
SetTimer(1,400,NULL);
}
首先在对话框初始化时SetTimer,使用上面的代码,出现的第二个提示对话框值是0,如果把MessageBox("123");
注销掉,则对话框显示0
也就是说KillTimer(1)返回值会因为前面调用了MessageBox函数而不同。
仔细看看MSDN关于KillTimer的返回值说明。
BOOL KillTimer( int nIDEvent );Return ValueSpecifies the outcome of the function. The value is nonzero if the event was killed. It is 0 if the KillTimer member function could not find the specified timer event.
第二个是显示你kilTimer的返回值而已
第二个是显示你kilTimer的返回值而已
第一段:
CString str;
MessageBox("123");
str.Format("%d",KillTimer(1));
MessageBox(str);
SetTimer(1,400,NULL);
第二段:
CString str;
str.Format("%d",KillTimer(1));
MessageBox(str);
SetTimer(1,400,NULL);
MessageBox(str);显示的结果会不一样,第一段显示0,第二段显示1,,我把MessageBox("123");换成显示模态对话框代码结果也是一样,,,
不知怎么会你测试的结果跟我不一样,,,