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 Question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Thu Jul 30, 2009 2:35 am    Post subject: GetPixel Question Reply with quote

Code:
procedure TForm1.Timer2Timer(Sender: TObject);
var
MS:hwnd;
MS2:hdc;
huh:Tpoint;
coloursux:COLORREF;
begin
  MS2:=GetDC(GetForegroundWindow());
  getcursorpos(huh);
  Label9.Caption:=inttostr(huh.x);
  Label10.Caption:=inttostr(huh.y);
  coloursux:=GetPixel(MS2,huh.X,huh.Y);
  Label6.Caption:=inttostr(GetRValue(coloursux));
  Label7.Caption:=inttostr(GetBValue(coloursux));
  Label8.Caption:=inttostr(GetGValue(coloursux));
  end;


Label9 and 10 is just for testing getcursorpos works or not.
Label6 and 7 and 8 I just get 255 in all colours or 0 in all colours when I tried to use in a game in full screen mode. But in windowed mode it works. Any1 konws how to enabled this for full screen mode?
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Thu Jul 30, 2009 2:50 am    Post subject: Reply with quote

Try to change:
Code:
GetDC(GetForegroundWindow());

To
Code:
GetDC(nil);
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Jul 30, 2009 2:56 am    Post subject: Reply with quote

Also make sure you

ReleaseDC(nil,MS2);
Back to top
View user's profile Send private message
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Thu Jul 30, 2009 3:06 am    Post subject: Reply with quote

smartz993 wrote:
Also make sure you

ReleaseDC(nil,MS2);


Thanks. I forget to add. But it does not works too.

@anden100
I get [DCC Error] Unit1.pas(580): E2010 Incompatible types: 'HWND' and 'Pointer'
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Jul 30, 2009 3:28 am    Post subject: Reply with quote

Try GetDC(0);
Back to top
View user's profile Send private message
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Thu Jul 30, 2009 3:34 am    Post subject: Reply with quote

Still get either 0 or 255
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Jul 30, 2009 3:36 am    Post subject: Reply with quote

Are you sure the pixel you're getting isn't the game's cursor?

Try adjusting x/y, images will be skewed because of the fullscreenedness.
Back to top
View user's profile Send private message
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Thu Jul 30, 2009 4:17 am    Post subject: Reply with quote

But it is just 0 or 255. The game is not just black or white...
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Thu Jul 30, 2009 4:18 am    Post subject: Reply with quote

I think that this could be caused by 'security' (not actually sure why it occurs but this is what I read somewhere anyway) implemented in Windows Vista (and probably 7 as well, I am yet to test) that for some reason, does not allow GDI functions to capture pixels from full screen applications. It's a frustrating but unavoidable limitation.
_________________
Back to top
View user's profile Send private message MSN Messenger
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Thu Jul 30, 2009 4:21 am    Post subject: Reply with quote

what's the game? if it's MS, getpixel's hooked, and if you already know that, you're getting the pixel colour. if it's white that's what you're getting.
_________________
Back to top
View user's profile Send private message MSN Messenger
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Thu Jul 30, 2009 4:30 am    Post subject: Reply with quote

I thought cripplehs make all api bypass?
Back to top
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Thu Jul 30, 2009 5:14 am    Post subject: Reply with quote

tanjiajun_34 wrote:
I thought cripplehs make all api bypass?


well whatever the bypass is at the moment does that, yeah, i just said that to see what game you're talking about. i used to have that problem as well until i realised i was getting the colour of the cursor. Confused

you need to get the cursor position, then move the mouse out of the way, then get the colour of the pixels at that location.

_________________
Back to top
View user's profile Send private message MSN Messenger
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