Original Post
I have a simple MFC dialog that starts a timer in the OnInitDialog() function by calling: m_uiTimer = SetTimer(WM_USER + 200, 1000, 0); my timer triggers void CViewDlg::OnTimer(UINT_PTR nIDEvent) { KillTimer(m_uiTimer); MessageBox("hi"); m_uiTimer = SetTimer(WM_USER + 200, 1000, 0); CDialog::OnTimer(nIDEvent); } //OnTimerand this works fine. However when I want to quit my application, I created a destructor that does this: CViewDlg::~CViewDlg() { if (m_uiTimer) { KillTimer( m_uiTimer ); } } when KillTimer in here is called I get an assert error: Debug Assertion Failed! ....bla bla bla.... \vs70builds\6030\vc\MFCATL\ship\atlmfc\include\afx win2.inl Line: 185 Anyone know what I may be doing wrong? I have also tried creating a separate "stopTimer()" function that I call when I am done with my dialog, but before CViewDlg is destroyed, but this also gives me the same assert error.