Autoclicker for games with GameGuard
Fairly simple, you don't need a lot of knowlegde to be able to use this.
Gameguard puts a 5 byte hook on the Postmessage API, that's why you are unable to send messages to the game with Postmessage if you don't bypass the hook.
But since there is a public method for that, there is no problem.
Download PMX.dll from the attachement. (it also includes a list of virtual keys)
The source for it is public too, but that's not of any importance for now.
Okay, first we are going to 'load' the .dll so we can use PostMessageX instead of PostMessage.
They both do exactly the same thing, the only difference is that you can send messages to games with GameGuard with PostMessageX.
Add this under
{$R *.dfm}:
function PostMessageX(hWnd:HWND; MSG:UINT; WPARAM:wParam; LPARAM:lParam):BOOL;stdcall;
external 'PMX.dll' name 'PostMessageX'
external 'PMX.dll' name 'PostMessageX'
Now add a timer to your project. (under the system tab)
We are going to use this one for the hotkeys.
You can choose to use 1 hotkey for enabling the timer (we're going to add that after this) and 1 for disabling it, or you can use 1 to enable and disable.
Now let's say you want to use F1 to enable the timer, and F2 to disable it, then add this part of code to the timer:
begin
if odd(GetAsyncKeyState(VK_F1)) then
Timer2.Enabled:=true;
if odd(GetAsyncKeyState(VK_F2)) then
Timer2.Enabled:=false;
end;
if odd(GetAsyncKeyState(VK_F1)) then
Timer2.Enabled:=true;
if odd(GetAsyncKeyState(VK_F2)) then
Timer2.Enabled:=false;
end;
This timer is timer1, timer2 will be the timer we add the code for sending the message to.
If you want to use 1 timer to enable and disable timer2, then add this code to the timer:
begin
if odd (GetAsyncKeyState(VK_F1)
then
if timer2.enabled := false then
timer2.enabled := true
else
timer1.enabled := false;
end;
if odd (GetAsyncKeyState(VK_F1)
then
if timer2.enabled := false then
timer2.enabled := true
else
timer1.enabled := false;
end;
Now add another timer, that will be timer2.
Also add an edit box.
First add the following variables:
- var
h:hwnd;
Point:TPoint;
x,y:integer;
begin
GetCursorPos(Point);
x:=Point.X;
y:=Point.Y;
A:=FindWindowA('MapleStoryClass',0);
if A<>0 then
begin
PostMessageX(A,WM_LBUTTONDBLCLK,0,MakeLong(X,Y)) ;
PostMessageX(A,WM_LBUTTONUP,0,MakeLong(X,Y));
Application.ProcessMessages;
end;
end;
GetCursorPos(Point);
x:=Point.X;
y:=Point.Y;
A:=FindWindowA('MapleStoryClass',0);
if A<>0 then
begin
PostMessageX(A,WM_LBUTTONDBLCLK,0,MakeLong(X,Y)) ;
PostMessageX(A,WM_LBUTTONUP,0,MakeLong(X,Y));
Application.ProcessMessages;
end;
end;
Now this is what the source should look like:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function PostMessageX(hWnd:HWND; MSG:UINT; WPARAM:wParam; LPARAM:lParam):BOOL;stdcall;
external 'PMX.dll' name 'PostMessageX'
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if odd (GetAsyncKeyState(VK_F1)
then
if timer2.enabled := false then
timer2.enabled := true
else
timer1.enabled := false;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
GetCursorPos(Point);
x:=Point.X;
y:=Point.Y;
A:=FindWindowA('MapleStoryClass',0);
if A<>0 then
begin
PostMessageX(A,WM_LBUTTONDBLCLK,0,MakeLong(X,Y)) ;
PostMessageX(A,WM_LBUTTONUP,0,MakeLong(X,Y));
Application.ProcessMessages;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function PostMessageX(hWnd:HWND; MSG:UINT; WPARAM:wParam; LPARAM:lParam):BOOL;stdcall;
external 'PMX.dll' name 'PostMessageX'
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if odd (GetAsyncKeyState(VK_F1)
then
if timer2.enabled := false then
timer2.enabled := true
else
timer1.enabled := false;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
GetCursorPos(Point);
x:=Point.X;
y:=Point.Y;
A:=FindWindowA('MapleStoryClass',0);
if A<>0 then
begin
PostMessageX(A,WM_LBUTTONDBLCLK,0,MakeLong(X,Y)) ;
PostMessageX(A,WM_LBUTTONUP,0,MakeLong(X,Y));
Application.ProcessMessages;
end;
end;
end.
Now press F9 to compile, and use the autoclicker on, in this case, MapleStory.
This will only click in MapleStory, not outside it.
Author: Micheltjuh
0 comentarios:
Publicar un comentario