Im still very new to programming and im trying to convert a decimal input from a ttedit, and i was wondering if im heading in the right direction with what iv tried so far, so would someone have a look at it for me and let me know were im going wrong if possible or if my whole idea is wrong please.
this is what iv tried so far.
unit Trainer_new_code;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, tlhelp32, StdCtrls, ExtCtrls, DB, DBTables, dblookup;
type
TForm2 = class(TForm)
Button1: TButton;
Table1: TTable;
DataSource1: TDataSource;
Button2: TButton;
DBLookupCombo1: TDBLookupCombo;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
PidHandle: integer;
PidID : integer;
data : string;
//variable containing string converted to integer
ICINT : integer;
//Variable containing string converted to hex
ICHEX : string;
Const
ProgramName = '_suIlluminus.exe';
implementation
{$R *.dfm}
//Find process
function GetProcessID(Const ExeFileName: string; var ProcessId: integer): boolean;
//procedure for 4bytes
procedure poke4(Address: Cardinal; Data: Cardinal);
var
Written: Cardinal;
begin
WriteProcessMemory(PidHandle, Pointer(Address), @Data, SizeOf(Data), Written);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
if GetProcessID(ProgramName, PidId) then
begin
ICINT := StrToInt(edit2.Text);
ICHEX := IntToHex(ICINT,4);
PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId);
//this is my main problem it wont accept a variable
//as a hexadecimal value but i need it to be a variable
//not a set value. Have tried variable types Word,string,cardinal.
poke4($44f6354,$ICHEX);
end else
begin
MessageDlg('Start Process First.', mtwarning, [mbOK],0);
end;
end;
end.
I hope someone can help iv not been able to find any other post on a variety of websites with a helpful answer.
thank you in advance