Archived

This topic is now archived and is closed to further replies.

SetTimer

This topic is 6114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites