1. ok so if i wanted to check if a pixel is white, what would i have to do? I dont understand the numbers GetPixel returns. Like "13026246" - its not enough numbers to be an RGB value and "4294967295" - thats to many numbers to be an RGB value. I really don't get it lol

2. Well if you looked at the link Indigo posted, it shows you how to interpret a COLORREF. The lower eight bits are for red, the next eight for green, and the next eight are blue. The last eight are zero. So one way to break up the parts would be to use bit shifting. Once you do this, each part (red, green, and blue) will be a value from 0 to 255.
Code:
```COLORREF color = GetPixel(hdc, x, y);
unsigned int r = color & 0xff;
unsigned int g = (color & 0xff00) >> 8;
unsigned int b = (color & 0xff0000) >> 16;

cout << "red: " << r << endl;
cout << "green: " << g << endl;
cout << "blue: " << b << endl;```
I think there are also some window macros which will break up a COLORREF. Or you could also use the bitset class from the standard library to make things easier.

3. >ok so if i wanted to check if a pixel is white, what would i have to do?
White would be a 255 for all three components (red=255, green=255, blue=255). Red of course would be (red=255, green=0, blue=0). So to check for white using the above code:
Code:
```if (r == 255 && g == 255 && b == 255)
{
//Pixel is white
}```
Or you could also write:
Code:
```if (color == 0xffffff)
{
//Pixel is white
}```

4. Code:
`0xffffff`
it doesnt work, neither does
Code:
`0x000000`
for black

and for some reason r g b are all getting the value 255 every time no matter what.

do you know what could cause this?

5. [EDIT] sorry for the double post

6. COLORREF is a waste of finger time, just use DWORD. (It's the same thing. )

Try this instead: It may mork and may not, so hey...
Code:
```DWORD color = GetPixel(hdc, x, y);
unsigned int r = GetRValue(color);
unsigned int g = GetGValue(color);
unsigned int b = GetBValue(color);

cout << "red: " << r << endl;
cout << "green: " << g << endl;
cout << "blue: " << b << endl;```

7. its the same thing with that to :S maybe if you all look at my code something may catch your eye that im doing wrong lol.

Code:
```int x,y,SX=347,SY=375;
unsigned char pixels[30][100];
unsigned int r,g,b;
HDC hdc = GetDC(NULL);
DWORD color=GetPixel(hdc,x,y);

for(y=SY;y<SY+30;y++)
for(x=SX;x<SX+100;x++)
{
color;
r=GetRValue(color);
g=GetGValue(color);
b=GetBValue(color);
if(r==255 && g==255 && b==255)
cout << "white ";
else if(r==0 && g==0 && b==0)
cout << "black ";
}```

8. Hmm, what's this?
Code:
```int x,y,SX=347,SY=375;
unsigned char pixels[30][100];
unsigned int r,g,b;
HDC hdc = GetDC(NULL);
DWORD color=GetPixel(hdc,x,y);
Sleep(2000);
for(y=SY;y<SY+30;y++)
for(x=SX;x<SX+100;x++)
{
color;
r=GetRValue(color);
g=GetGValue(color);
b=GetBValue(color);
if(r==255 && g==255 && b==255)
cout << "white ";
else if(r==0 && g==0 && b==0)
cout << "black ";
}```

9. that does the GetPixel() function doesnt it?

10. No, this does:
Code:
```int x,y,SX=347,SY=375;
unsigned char pixels[30][100];
unsigned int r,g,b;
HDC hdc = GetDC(NULL);
DWORD color=GetPixel(hdc,x,y);
Sleep(2000);
for(y=SY;y<SY+30;y++)
for(x=SX;x<SX+100;x++)
{
color;
r=GetRValue(color);
g=GetGValue(color);
b=GetBValue(color);
if(r==255 && g==255 && b==255)
cout << "white ";
else if(r==0 && g==0 && b==0)
cout << "black ";
}```
You both create and assign color on the same line.

11. ah ok i see your point, i'll give it a shot.

12. What are you trying to get an image of anyway? If it's another window then you need to set your hdc to it's hdc, and start getting the pixels at 0x0.

13. i fixed it here's what ive got, and ya im getting the pixel values of an image in a browser

Code:
```int x,y,pixel=-1,wpix,offset;
unsigned char pixels[30][100];
unsigned int r,g,b;
HDC hdc = GetDC(NULL);
DWORD color;
Sleep(3000);
for(y=SY;y<SY+30;y++)
for(x=SX;x<SX+100;x++)
{
pixel=pixel+1;
color=GetPixel(hdc,x,y);
r=GetRValue(color);
g=GetGValue(color);
b=GetBValue(color);
if(r==255 && g==255 && b==255)
// white pixel```

14. Originally Posted by Yarin
COLORREF is a waste of finger time, just use DWORD. (It's the same thing. )
Until the definition of DWORD or COLORREF changes.

15. Code:
`pixel=pixel+1;`
can be
Code:
`pixel += 1;`