BOOL CTestDlg::OnInitDialog()
{
//...
// TODO: Add extra initialization here
SetTimer(0, 10000, NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
CTestDlg::~CTestDlg()
{
KillTimer(0); // error here, why?
}
The SetTimer function returns a value. It is this value you should pass to KillTimer function
1 2 3 4 5 6 7 8 9 10 11 12 13 14
BOOL CTestDlg::OnInitDialog()
{
//assume we have a member variable called m_timerID
// TODO: Add extra initialization here
m_timerID = SetTimer(1, 10000, NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
CTestDlg::~CTestDlg()
{
KillTimer(m_timerID);
}