I haven\'t written anything with GDI for a while now (and never with GDI+), and I\'m just working on a fun project, but for the life of me, I can\'t figure out how to double
CreateCompatibleDC(hdc) creates a DC with a 1x1 pixel monochrome bitmap as its drawing surface. You need to also CreateCompatibleBitmap and select that bitmap into the hdcBuffer if you want a drawing surface larger than that.
Edit:
the flickering is being caused by WM_ERASEBKGND, when you do this
hdc = BeginPaint(hWnd, &ps);
Inside the call to BeginPaint, Windows sends your WndProc a WM_ERASEBKGND message if it thinks the background needs to be redrawn, if you don't handle that message, then DefWindowProc handles it by filling the paint rectangle with your class brush, so to avoid the flickering, you should handle it and return TRUE.
case WM_ERASEBKGND:
return TRUE; // tell Windows that we handled it. (but don't actually draw anything)
Windows thinks your background should be erased because you tell it that it should, that's what RDW_ERASE means, so you should probably leave that out of your RedrawWindow call