SetTimer

Started by
0 comments, last by Nat 23 years ago
Which is the best place to have this function in a CView class. If I put it in the constructor it gives a Runtime error ?? Also do i always have to delete the dc I get like this CClientDC dc(this); ...... ....... dc.DeleteDC() ... causes Crash in program .. I am basically trying to create a simple movement of graphics based on WM_TIMER message. But seem to be running into probs .. SetTimer(2, 100, NULL); if this is in the constructor it causes a crash !! Help please! thanks!
~~~º¥º -
Advertisement
You don''t need to call DeleteDC. That''s because the DC will be deleted by the CClientDC destructor when the object goes out of scope. Deleting the DC manually will cause an illegal operation.

Don''t call SetTimer in the constructor. You should call it in the WM_CREATE handler, which should be SomeClass::OnCreate.

That ought to work.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.

This topic is closed to new replies.

Advertisement