| View previous topic :: View next topic |
| Author |
Message |
tanjiajun_34 Grandmaster Cheater
Reputation: 0
Joined: 16 Feb 2006 Posts: 786 Location: Singapore
|
Posted: Thu Jul 30, 2009 2:35 am Post subject: GetPixel Question |
|
|
| 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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Thu Jul 30, 2009 2:50 am Post subject: |
|
|
Try to change:
| Code: | | GetDC(GetForegroundWindow()); |
To
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Thu Jul 30, 2009 2:56 am Post subject: |
|
|
Also make sure you
ReleaseDC(nil,MS2);
|
|
| Back to top |
|
 |
tanjiajun_34 Grandmaster Cheater
Reputation: 0
Joined: 16 Feb 2006 Posts: 786 Location: Singapore
|
Posted: Thu Jul 30, 2009 3:06 am Post subject: |
|
|
| 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 |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Thu Jul 30, 2009 3:28 am Post subject: |
|
|
| Try GetDC(0);
|
|
| Back to top |
|
 |
tanjiajun_34 Grandmaster Cheater
Reputation: 0
Joined: 16 Feb 2006 Posts: 786 Location: Singapore
|
Posted: Thu Jul 30, 2009 3:34 am Post subject: |
|
|
| Still get either 0 or 255
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Thu Jul 30, 2009 3:36 am Post subject: |
|
|
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 |
|
 |
tanjiajun_34 Grandmaster Cheater
Reputation: 0
Joined: 16 Feb 2006 Posts: 786 Location: Singapore
|
Posted: Thu Jul 30, 2009 4:17 am Post subject: |
|
|
| But it is just 0 or 255. The game is not just black or white...
|
|
| Back to top |
|
 |
LolSalad Grandmaster Cheater
Reputation: 1
Joined: 26 Aug 2007 Posts: 988 Location: Australia
|
Posted: Thu Jul 30, 2009 4:18 am Post subject: |
|
|
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 |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Thu Jul 30, 2009 4:21 am Post subject: |
|
|
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 |
|
 |
tanjiajun_34 Grandmaster Cheater
Reputation: 0
Joined: 16 Feb 2006 Posts: 786 Location: Singapore
|
Posted: Thu Jul 30, 2009 4:30 am Post subject: |
|
|
| I thought cripplehs make all api bypass?
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Thu Jul 30, 2009 5:14 am Post subject: |
|
|
| 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.
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 |
|
 |
|