unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxControls, cxContainer, cxEdit, cxLabel, ExtCtrls, cxTextEdit,
cxMaskEdit, cxSpinEdit, cxCheckBox, Menus, cxLookAndFeelPainters, StdCtrls,
cxButtons;
type
TfmMain =
class(TForm)
cxLabel1: TcxLabel;
Image1: TImage;
cxSpinEdit1: TcxSpinEdit;
cxLabel2: TcxLabel;
cxSpinEdit2: TcxSpinEdit;
cxLabel3: TcxLabel;
cxSpinEdit3: TcxSpinEdit;
cxLabel4: TcxLabel;
cxSpinEdit4: TcxSpinEdit;
cxCheckBox1: TcxCheckBox;
Timer1: TTimer;
cxLabel5: TcxLabel;
cxLabel6: TcxLabel;
cxLabel7: TcxLabel;
Shape1: TShape;
cxButton1: TcxButton;
cxButton2: TcxButton;
procedure cxCheckBox1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure cxButton2Click(Sender: TObject);
procedure cxButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
function ReadValue(aAdresse:integer):integer;
function WriteValue(aAdresse,aValue:integer):integer;
public
{ Public-Deklarationen }
end;
var
fmMain: TfmMain;
WindowName: Integer;
ThreadId: Integer;
ProcessId: Integer;
HandleWindow: Integer;
const
// WindowTitle = 'Harry Potter und der Feuerkelch' + #153;
WindowTitle = '
Project2';
AddressLeben = $241BC08;
AddressSuperShoot = $241D15A;
AddressBohnenHarry = $24194F0;
AddressBohnenHermin = $24194F8;
AddressBohnenRonald = $24194F4;
implementation
{$R *.dfm}
procedure TfmMain.cxButton1Click(Sender: TObject);
begin
cxSpinEdit1.Value:= ReadValue(AddressLeben);
cxSpinEdit2.Value:= ReadValue(AddressBohnenHarry);
cxSpinEdit3.Value:= ReadValue(AddressBohnenHermin) ;
cxSpinEdit4.Value:= ReadValue(AddressBohnenRonald) ;
end;
procedure TfmMain.cxButton2Click(Sender: TObject);
begin
WriteValue(AddressLeben,cxSpinEdit1.Value);
WriteValue(AddressBohnenHarry,cxSpinEdit2.Value);
WriteValue(AddressBohnenHermin,cxSpinEdit3.Value);
WriteValue(AddressBohnenRonald,cxSpinEdit4.Value);
end;
procedure TfmMain.cxCheckBox1Click(Sender: TObject);
begin
Timer1.Enabled:=cxCheckBox1.Checked;
end;
procedure TfmMain.FormCreate(Sender: TObject);
begin
WindowName := FindWindow(
nil, WindowTitle);
if WindowName = 0
then
begin
MessageDlg('
Das Spiel läuft nicht !! Spiel Starten !!', mtwarning, [mbOK], 0);
Close;
end;
ThreadId := GetWindowThreadProcessId(WindowName, @ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
end;
function TfmMain.ReadValue(aAdresse:integer): integer;
var
aValue:integer;
Bytesread : DWORD;
begin
ReadProcessMemory(HandleWindow, ptr(aAdresse), @aValue,sizeof(aValue),Bytesread);
Result:=aValue;
end;
procedure TfmMain.Timer1Timer(Sender: TObject);
begin
WriteValue(AddressSuperShoot,17130);
end;
function TfmMain.WriteValue(aAdresse,aValue: integer): integer;
var
Bytesread : DWORD;
begin
WriteProcessMemory(HandleWindow, ptr(aAdresse), @aValue, sizeof(aValue), Bytesread);
end;
end.