Original Post
Ok, here''s my code.
I get nothing but a black screen. Earlier in my program I generated a button press of the PRINT SCREEN key to put something in the clipboard, and I verified that after I ran my program it did in fact copy the screen to the clipboard. I also verified that there is in fact a bitmap of the type CF_BITMAP in the clipboard using the IsClipboardFormatAvailable(CF_BITMAP) function. So as far as I can tell, I have a valid handle to a bitmap. Any ideas?
void UpdateDisplay(HWND hwnd)
{
HBITMAP hbm = (HBITMAP)GetClipboardData(CF_BITMAP);
HDC source, dest;
RECT rect;
GetClientRect(hwnd, ▭);
dest = GetDC(hwnd);
source = CreateCompatibleDC(0);
SelectObject(source,hbm);
BitBlt(dest,0,0,rect.right, rect.bottom, source,0,0,SRCCOPY);
DeleteDC(source);
DeleteObject(hbm);
ReleaseDC(hwnd,dest);
}
|