Click to See Complete Forum and Search --> : Retrieving color value of a pixel


kurtk
January 17th, 2006, 05:23 AM
Hello,

is it possible to retrieve the color value of an arbitrary pixel on the screen, without knowing (or caring) what window this pixel "belongs" to? And how?

Thank you very much.

golanshahar
January 17th, 2006, 06:39 AM
yes you can :)

here is a sample that take pixel value from screen at the 100,100 position:


HDC dc = ::GetDC(0);
COLORREF Color = ::GetPixel(dc,100,100);
int R = GetRValue(Color);
int G = GetGValue(Color);
int B = GetBValue(Color);
::ReleaseDC(0,dc);



Cheers