Mathew Joy
November 26th, 2003, 02:15 AM
BitBlt seems to work only if the destination DC is the client window. I actually want to copy more than one bitmaps to different locations of a dc and then display it on the client window. But I am unable to copy the image from one DC to another. The code is from the WndProc callback function: case WM_PAINT:
hdcClient = BeginPaint (hwnd, &ps) ;
hdcMainMem = CreateCompatibleDC(hdcClient);
hdcMem = CreateCompatibleDC(hdcClient);
SelectObject(hdcMem,hBitmap);
BitBlt(hdcMainMem, 0, 0, 250, 250, hdcMem, 0, 0, SRCCOPY); //just assuming the height and width
BitBlt(hdcClient, 0, 0, 500, 500, hdcMainMem, 0, 0, SRCCOPY);
DeleteDC (hdcMem) ;
DeleteDC (hdcMainMem) ;
ReleaseDC(hwnd,hdcClient);
EndPaint(hwnd, &ps);
break;
Am I doing it correctly?
hdcClient = BeginPaint (hwnd, &ps) ;
hdcMainMem = CreateCompatibleDC(hdcClient);
hdcMem = CreateCompatibleDC(hdcClient);
SelectObject(hdcMem,hBitmap);
BitBlt(hdcMainMem, 0, 0, 250, 250, hdcMem, 0, 0, SRCCOPY); //just assuming the height and width
BitBlt(hdcClient, 0, 0, 500, 500, hdcMainMem, 0, 0, SRCCOPY);
DeleteDC (hdcMem) ;
DeleteDC (hdcMainMem) ;
ReleaseDC(hwnd,hdcClient);
EndPaint(hwnd, &ps);
break;
Am I doing it correctly?