Basically i am trying to write a program to change the value of money in co, I know it can be easily done with programs like TSearch, but I want to make my own simple program, specifally for co and easier.
My code so far:
Basically, so far ive just got stuck on writing the value in the text box to the variable PokeValue1 because even though I've done a string to int conversition, it still says incompatiable types string and integer.
Some1 help please :rolleyes:
My code so far:
Code:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure RadioButton1milClick(Sender: TObject);
procedure RadioButton10milClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
Var
WindowName : integer;
ProcessId : integer;
ThreadId : integer; // defining variable's types ;
buf : PChar;
HandleWindow : Integer;
write : cardinal;
PokeValue1 : integer; //!the value that will be wriiten to co ;
Const
WindowTitle = '[Conquer2.0]'; //defines the window name ;
Address1 = $57C140; //defines the address to poke ;
NumberOfBytes1 = 4; //defines amount of bytes to write;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
begin
Edit1.Text := StrToInt(PokeValue1);
If WindowName = 0 then // check if the game is running;
begin
MessageDlg('Conquer isnt running idiot.', mtwarning,[mbOK],0);
end;
// the following will writes the value;
ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
GetMem(buf,1);
buf^ := Chr(PokeValue1);
WriteProcessMemory(HandleWindow,ptr(Address1),buf,NumberOfBytes1,write);
FreeMem(buf);
closehandle(HandleWindow);
end;
end;
Some1 help please :rolleyes: