Search code examples
visual-c++mfcflickerdwmvsync

V-Sync in MFC and GDI+


hi I'm using MFC SDI application for my mid term project. but every time i draw scene (with GDI) and "invalidate()" it flicking occur.

I use DWM for double buffering and removing flicking but it rarely occur. i think problem is in the vertical syncing.what can I do for enabling virtual syncing


Solution

  • Try overriding OnEraseBkgnd and simply return TRUE and do nothing else. This will prevent the background being "erased" each time you draw. Returning TRUE says "I've erased it`, even if you've done no such thing.