I'm trying to grab a window content so that I can later convert it into a bitmap image.
Is it possible? I know how to get the window handler and how to resize it with that handler but, how could I grab a picture like Print Screen currently does.
Thank you in advance.
1. Get screen DC
HDC hdcScreen = GetDC(NULL);
2. Get Window (being captured) bounds
3. Allocated a DC and a bitmap:
HDC hdcMem = CreateCompatibleDC(hdcScreen);
HBITMAP hbmCapture = CreateCompatibleBitmap(hdcScreen, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top);
HGDIOBJ hbm = SelectObject(hdcMem, hbmCapture);
4. Blit a block to the memory DC
BitBlt(hdcMem, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, hdcScreen, rcWindow.left, rcWindow.top, SRCCOPY);
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?