Memory DC, How?
Posted on 2003-11-21
I've been though a ton of sample source, and still am so confused on this. What I need to do seems so simple, yet I cannot seem to get the syntax down.
I have two DCs, hCurrentPage and hNextPage. Both DCs have the same dimensions. Here is what I need to do.
1. Create a memory DC
//set drawing rectangle to the dimensions of the pages
//create the memory DC
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
HDC hdcCompatible = CreateCompatibleDC(hdcScreen);
HBITMAP hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES), GetDeviceCaps(hdcScreen, VERTRES));
2. Copy the content of hNextPage into a memory DC using BitBlt SRCCOPY
::BitBlt(hdcCompatible, 0,0, rcDraw.Width(), rcDraw.Height()
, hNextPage, 0, 0, SRCCOPY);
3. Copy the content of hCurrentPage into the memory DC using BitBlt SRCCOPY
//In the actual program I deflate the rectangle, but for clarity I have ommitte that code
4. Copy the combined content in the memory DC to hCurrentPage using BitBlt SRCCOPY
, hdcCompatible, rcNew.left, rcNew.top, SRCCOPY);
5. Delete the memory DC
What am I doing wrong? If it makes any difference, the above code is in a loop to perform a transition between hCurrentPage and hNextPage.