Posted: Sun Aug 24, 2008 4:02 pm Post subject: GetPixel always returns 255,255,255
Code:
bool CheckForMine()
{
HWND Desktop = GetDesktopWindow();
HDC Hdc = GetDC(Desktop);
COLORREF Color = GetPixel(Hdc, 0, 0);
unsigned short int RED = GetRValue(Color);
std::cout << RED << "\t";
unsigned short int BLUE = GetBValue(Color);
std::cout << BLUE << "\t";
unsigned short int GREEN = GetGValue(Color);
std::cout << GREEN << "\n";
if (RED == 255 && BLUE == 255 && GREEN == 255)
return true;
return false;
}
[b]EDIT[/b]
Nevermind I got it to work, jsut switch GetDesktopWindow() to HWND_DESKTOP.
I used GetLastError(), but there was not errors. No matter what color I put in the top left corner, it iwll always return 255,255,255. What am I doing wrong?
EDIT
Nevermind I got it, all I ahd to do is change GetDesktopWindow() to HWND_DESKTOP. _________________
What dosen't kill you, usually does the second time.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum