| View previous topic :: View next topic |
| Author |
Message |
iNext Expert Cheater
Reputation: 0
Joined: 06 Aug 2007 Posts: 138
|
Posted: Sun Aug 24, 2008 3:42 pm Post subject: [Delphi] GetPixel Help |
|
|
I know I've already asked something like this not too long ago but I guess I don't really understand how to use the GetPixel Function.
Here's what I'm trying to do and if someone could maybe tell me what to use or something that would be awesome.
I'm searching a .swf game's screen in 6 separate points [each one is 1 pixel] (they are to be hard coded). Each point is then scanned for its color value and if the color of that pixel is above a certain amount then a key press is simulated and the process is then repeated. I also want all of these pixels to be scanned at the same time so that if the color at 2 or more places change then 2 or more key presses will be simulated.
I understand most what should be going on in the Delphi code, I just don't know how to set it up properly. If someone could point me in the right direction, give me a sample code, or give me a link to a tutorial, or just any information at all that would be awesome.
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sun Aug 24, 2008 5:43 pm Post subject: |
|
|
Something like this?
| Code: |
function LookForColors;
var
c: TCanvas;
col:TColor;
red,blue,green:integer;
begin
c := TCanvas.Create;
try
c.Handle := GetWindowDC(GetDesktopWindow);
col := GetPixel(c.Handle, X, Y); //MAKE THESE THE X+Y YOU WANT
red := GetRValue(col);
blue := GetBValue(col);
green:= GetGValue(col);
if red = 255 and blue = 255 and green = 255 then
//SENDKEY HERE
finally
c.Free;
end;
end; |
You could check col against a solid value instead of red/green/blue individually, but its up to you. Just have fun from there.
*Instead of using the Desktop's handle, get the handle of the SWF window.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Aug 24, 2008 6:01 pm Post subject: |
|
|
Why needlessly complicate it?
| Code: | void Boners(COLORREF color){
if(GetPixel(hdc, 0, 0) == color){
MessageBeep(MB_OK);
}Sleep(10);
} |
Just feed it an RGB macro.
Surely you can figure out the window size and how to loop through it on your own.
|
|
| Back to top |
|
 |
iNext Expert Cheater
Reputation: 0
Joined: 06 Aug 2007 Posts: 138
|
Posted: Sun Aug 24, 2008 6:05 pm Post subject: |
|
|
Thanks. I'm pretty sure I can take it from here now.
|
|
| Back to top |
|
 |
|