• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

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

?
0
Troudeloup
Asked:
Troudeloup
  • 3
  • 2
1 Solution
 
Jaime OlivaresCommented:
COLORREF is a 32-bit value
0
 
TroudeloupAuthor Commented:
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?
0
 
Jaime OlivaresCommented:
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

0
 
TroudeloupAuthor Commented:
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.
0
 
Jaime OlivaresCommented:
msdn.microsoft.com
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now