I'm trying to use Windows APIs to take a screen shot of a window. Here is my current code:
//Grab the window
HWND window = me;//GetForegroundWindow();
HDC context = GetDC(window);
RECT windowRect;
GetWindowRect(window, &windowRect);
int w = windowRect.right-windowRect.left;
int h = windowRect.bottom-windowRect.top;
//Copy the data
for (int y=0;y<h;y++)
for (int x=0;x<w;x++)
{
COLORREF color = GetPixel(context, x,y);
std::cout<<color<<std::endl;
}
The width and height return correctly (as well as the window location), but the color is always 0xFFFFFF (white).
It seems like it should be fairly easy as in windows taking a screenshot of a window is simply alt
+shift
+Print Screen