Someone that knows delphi can help?

04/23/2006 01:18 .:Suck2:.#1
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:

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   &#59;
 buf : PChar;
 HandleWindow : Integer;
 write : cardinal;
 PokeValue1 : integer;  //!the value that will be wriiten to co  &#59;

 Const
 WindowTitle = '[Conquer2.0]'; //defines the window name &#59;
 Address1 = $57C140;    //defines the address to poke  &#59;

 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;
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:
04/23/2006 01:29 unknownone#2
Fist off I can't see you assigning anything to WindowName. I'm looking all over for
WindowName := FindWindow(0, WindowTitle);

The PokeValue1 is an integer, and you're saying convert this string to an int. I think you want IntToStr.

EDIT: Actually, looking at that again, dont you want to assign the value in the text box to the integer
PokeValue1 := StrToInt(Edit.text)

The 5th arg of WPM should be a pointer, but its optional, may aswell null it.

I'm not well versed with Pascal, so can't help more than that.
04/23/2006 01:48 .:Suck2:.#3
thank you for trying. Um, no i dont think it shud be PokeValue1 := StrToInt(Edit.text); becos im trying to assign the user input value to the variable pokevalue1, not the otheray round.
04/23/2006 07:26 .:Suck2:.#4
Bump. Need help :P
05/14/2013 12:21 Alikarbam#5
Have a look on my topic [Only registered and activated users can see links. Click Here To Register...]. On the Unit2.pas have a procedure:
Code:
function WriteByte(Address: Cardinal; ChangeValues: Byte):boolean;
....
Function TForm2.WriteByte(Address: Cardinal; ChangeValues: Byte): boolean;
Begin
  Result := WriteProcessMemory(AtProc, Pointer(Address), @ChangeValues,
    SizeOf(ChangeValues), Written);
End;

//Where AtProc = OpenProcess(PROCESS_ALL_ACCESS, False, Process_ID);
...
05/14/2013 13:40 InfamousNoone#6
have a look at the date of posts
05/15/2013 11:41 Alikarbam#7
I didn't noticed that was so old O_O
The forum are showing it to me on "Similar Threads" i think that was a new post.
[Only registered and activated users can see links. Click Here To Register...]