I am trying to set up a double buffering system for a program I am making so that I can draw images to a blank window without flicker. One problem!!! Lemme explain my code first, and then tell you the problem:
wndWidth and wndHeight are set to equal the width and height of the client rect, and hWnd is set to the window's handle.Code:HDC prime, second; HBITMAP hbmp; prime = GetDC( hWnd ); second = CreateCompatibleDC( prime ); hbmp = CreateCompatibleBitmap( prime, wndWidth, wndHieght ); SelectObject( second, hbmp ); // Draw something on secondd here... // BitBlt( prime, 0, 0, wndWidth, wndHeight, second, 0, 0, SRCCOPY );
My problem is: Whe i run the program the client rect is filled with all sorts of colors, looks like a mixed-up, jumbled picture of vc++ and my code!!! I even tried to set the DC to completely white first, but it doesnt work!!! I can still draw to the DC, but i can't figure out why its doing that. Does anyone know?




Reply With Quote