Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GetPixel always returns 255,255,255

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Sun Aug 24, 2008 4:02 pm    Post subject: GetPixel always returns 255,255,255 Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites