ok so for the past half year I've been trying to double buffer my app as it flickers madly when I resize it. Well I was able to Set WM_ERASEBGRND to true to stop it from erasing the Background and under my WM_PAINT my windows procedure I was able to blitblt a gray background on my form so its just not all black.

The thing is is that all of the controls flicker and I even replaced all of my SetWindowPos with DeferWindowPos.

Before this I used WS_EX_COMPOSITED and eve though it does a pretty good job with it, it doesn't update any of my scroll bars. For example if I clicked on a scroll thumb and moved it to the top you have to let go of it for it to update the scroll bar. And when you click down on the buttons for the scroll bars they no longer sink in like they use to which causes problems.

Anyways here is the code I'm using which I found off line and trying to get it to work so my controls stop flickering:

Code:
case WM_ERASEBKGND:
    return 1;
    break;

HDC          hdcMem;
HBITMAP      hbmMem;
HANDLE       hOld;
 
PAINTSTRUCT  ps;
HDC          hdc;
RECT Temp_Rect; 

case WM_PAINT:
 Temp_Rect=SSMAIN_RECT;
    // Get DC for window
    hdc = BeginPaint(hwnd, &ps);
 
    // Create an off-screen DC for double-buffering
    hdcMem = CreateCompatibleDC(hdc);
    hbmMem = CreateCompatibleBitmap(hdc, SSMAIN_WIDTH,SSMAIN_HEIGHT);
 
    hOld   = (HBITMAP)SelectObject(hdcMem, hbmMem);
 
    // Draw into hdcMem here
 
    // Transfer the off-screen DC to the screen
    Temp_Rect.left=-200;
      Temp_Rect.top=-200;
    FillRect(hdcMem, &Temp_Rect, (HBRUSH) (COLOR_WINDOW+7));
    BitBlt(hdc, 0, 0,  SSMAIN_WIDTH, SSMAIN_HEIGHT, hdcMem, 0, 0, SRCCOPY);
 
    // Free-up the off-screen DC
    SelectObject(hdcMem, hOld);
    DeleteObject(hbmMem);
    DeleteDC    (hdcMem);
 
    EndPaint(hwnd, &ps);
   
    break;