you need to silence the
WM_ERASEBKGND[
^] message by handling it and simply returning
FALSE
.
This paints over everything, which is the cause of your flickering.
Then you need to actually erase the background in your WM_PAINT (or equivalent message for your control) as part of the memory DC. (This would simply be
FillRect()[
^] with a brush of white or whatever colour (perhaps COLOR_BTNFACE))