The WM_ERASEBKGND message is passed a pre-initialized DC in the wParam parameter. An application that handles WM_ERASEBKGND should use this DC to paint the bacground, because any drawing actions that are performed will be clipped to the current update region in order to reduce flicker on the update.