Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie has problem with SetTimer function

Status
Not open for further replies.

alcyone

Programmer
Sep 6, 2000
33
Hi all,

Can anyone point me in the right direction about the following problem: I try to make a timer in my View, but when I add a call to SetTimer in my code, it compiles ok, but when running I get a error message 'Debug assertion failed! in afxwin2.inl .
What am I doing wrong?

Thanks very much for any help!


BEGIN_MESSAGE_MAP(CATCsimView, CView)
//{{AFX_MSG_MAP(CATCsimView)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

...

CATCsimView::CATCsimView()
{
// TODO: add construction code here
SetTimer (ID_CLOCK_TIMER, 1000, NULL);
}

...

void CATCsimView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default

CView::OnTimer (nIDEvent);
}
 
I wouldn't put the call to SetTimer inside the class constructor. Since it's a windows class, I would put it in the OnCreate(...) message handler at the earliest. Give that a try and see what happens.
 
Thank you Gorgor, that was indeed the fact! Now it works fine! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top