-
GetPixel with DISPLAY
Hi there,
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.
I'm using
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,
Phil Drew.
:rolleyes:
-
Should be:
Code:
HDC hdc = CreateDC("DISPLAY", NULL, NULL,NULL);
Also, it might be a good idea to check the return value to make sure it's a valid dc.
-
D'oh!
That's fixed it!
Thanks a lot!
P.