Hey.

I'm getting a failed assertion for this code at the bolded line:
Code:
void CMFCDeviceSimulatorDlg::Start_Timer(UINT timer_duration)
{
	timer_id = static_cast<UINT>(SetTimer(IDT_TIMER_0, timer_duration, NULL));

	if(timer_id == 0)
	{
		throw std::runtime_error("Couldn't set timer.");
	}
}

void CMFCDeviceSimulatorDlg::Stop_Timer()
{
	if(!KillTimer(timer_id))
	{
		throw std::runtime_error("Couldn't kill timer.");
	}
	timer_id = 0;
}
Code:
static const UINT TIMER_DURATION = 500;
	UINT timer_id;
The assertion fails at this code in afxwin2.inl:
Code:
_AFXWIN_INLINE BOOL CWnd::KillTimer(UINT_PTR nIDEvent)
	{ ASSERT(::IsWindow(m_hWnd)); return ::KillTimer(m_hWnd, nIDEvent); }
I sort of understand why it's doing it, as I read this.. but I have no idea on how to add the OnDestroy handler. For instance, do I just add the function, or do I have to add stuff to the message map etc.? There's not much information on this on the net...

Cheers.