Link to home
Start Free TrialLog in
Avatar of Troudeloup
Troudeloup

asked on

code specifc; byte into int

HDC hWindowDC = ::GetDC(hWnd);
(?)          COLORREF GetPixel(   HDC hWindowDC, int x, int y );



I have problem with the (?) part.
what type of variable do I use to store data from getpixel?


also, how do I convert those values into

int red
int green
int blue

?
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

COLORREF is a 32-bit value
Avatar of Troudeloup
Troudeloup

ASKER

ok so I do

COLORREF pixel_color = GetPixel(   HDC hWindowDC, int x, int y );

and then
uh i never did this conversion before,

how do I do it?
you can use as COLORREF color = GetPixel(......)
if you want to know independent color GetRValue(), GetGValue() and GetBValue() as

COLORREF color = GetPixel(someHDC, 50, 50); // just an example
int blue = GetBValue(color);

More help here:
http://msdn2.microsoft.com/en-us/library/aa923096.aspx

int blue = GetBValue(color);

got it



how do you pro guys find all of these information?  it would be crazy if i think you are born with it.
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial