GetPixel with DISPLAY
Hope you can help me with my latest problem...
I'm trying to use GetPixel with the display's DC to get the COLORREF of the pixels on the whole screen.
HDC hdc = CreateDC(NULL, "DISPLAY", NULL, NULL);
to get the HDC for the screen, and then
COLORREF c = GetPixel(hdc, x, y);
but when I use GetRValue etc. on c, I always get -1.
x and y are integers from 0 to 1024 and 768 respectively.
I've also tried
CDC* pDC = GetDC();
COLORREF c = pDC->GetPixel(x,y);
but the same thing happens. I'm guessing this might be a clipping region issue, but shouldn't the values i gave above be valid for my screen (set to 1024*768) ?
Cheers for any help you can give,
Also, it might be a good idea to check the return value to make sure it's a valid dc.
HDC hdc = CreateDC("DISPLAY", NULL, NULL,NULL);
That's fixed it!
Thanks a lot!