魔兽贱队 发表于 2011-4-4 10:20:11

delphi新手 怎么用监视热键 来使用一个CALL

怎么用delphi监视热键 来使用一个CALL 谁有例子 给个学习学习

树上爬的猪 发表于 2011-4-4 10:20:27

unit HJmain;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
procedure addManey();stdcall;
type
TForm1 = class(TForm)
    lbl1: TLabel;
    edt1: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
aatom:atom;
procedure hotkey(var msg:tmessage);message wm_hotkey;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure addmy ;
var
h:HWND ;
pid,hProcessID:THandle;
calladdr:Pointer ;
writeByte:DWORD ;
begin
h:=FindWindow(nil ,'Red Alert 2');
GetWindowThreadProcessId(h,pid);
hProcessID :=OpenProcess(PROCESS_ALL_ACCESS ,False,pid);
//在游戏进程分配内存
calladdr :=VirtualAllocEx(hProcessID ,nil,MAX_PATH,MEM_COMMIT OR MEM_RESERVE,PAGE_EXECUTE_READWRITE);
WriteProcessMemory(hProcessID ,calladdr ,@addManey,MAX_PATH ,writeByte );
CreateRemoteThread(hProcessID ,nil,0,calladdr ,nil,0,writeByte );
end;
procedure TForm1.hotkey(var msg:tmessage);
begin
if (msg.LParamHi=VK_F1)then // 判断是否按F1
begin
      addmy ;                                  //执行 子程序
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
   aatom:=GlobalAddAtom('hotkey');
   RegisterHotKey(Form1 .Handle ,aatom,0,VK_F1);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
    globalDeleteatom(aatom);
end;
procedure addManey();stdcall;
var
   shuju:DWORD;
begin
asm
mov eax,$00a35db4
mov eax,
add eax,$24c
add ,$FFFF
//mov eax,
//mov shuju,eax       //远程置入 不传递变量
end;
Form1.edt1.Text :=IntToStr(shuju);
end;
end.
页: [1]
查看完整版本: delphi新手 怎么用监视热键 来使用一个CALL