AbbasAkhtar
Programmer
can someone please check this code out,
it works for me, but there is something strange going on,
when i compile the exe, it saves and reads from itself, and the app doesnt need to shutdown, and when u open the exe in wordpad, and go to find and look for the ini settings u saved in the document u opened (exe file), it will find it, but its strange, i cant explain it
when i encrypt the exe using neolite pro, it still works saves and reads to itself, but when u open using wordpad, everything looks encrypted, and u cant find the data that ur saving anymore ?
does this method save external ini file, or actually inside the exe file ? could someone explain this, look below for source code.
does this actually save inside the exe ? and can i add encryption, and will it work ?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Inifiles;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
MyAppini : TIniFile;
begin
try
MyAppini := TIniFile.Create(ExtractFileName(Application.ExeName));
Left := MyAppini.ReadInteger(Caption,'Left',Left);
Top := MyAppini.ReadInteger(Caption,'Top',Top);
Width := MyAppini.ReadInteger(Caption,'Width',Width);
Height := MyAppini.ReadInteger(Caption,'Height',Height);
finally
MyAppini.Free;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
MyAppini : TIniFile;
begin
try
MyAppini := TIniFile.Create(ExtractFileName(Application.ExeName));
MyAppini.WriteInteger(Caption,'Top',Top);
MyAppini.WriteInteger(Caption,'Left',Left);
MyAppini.WriteInteger(Caption,'Width',Width);
MyAppini.WriteInteger(Caption,'Height',Height);
finally
MyAppini.Free;
end;
end;
end.
it works for me, but there is something strange going on,
when i compile the exe, it saves and reads from itself, and the app doesnt need to shutdown, and when u open the exe in wordpad, and go to find and look for the ini settings u saved in the document u opened (exe file), it will find it, but its strange, i cant explain it
when i encrypt the exe using neolite pro, it still works saves and reads to itself, but when u open using wordpad, everything looks encrypted, and u cant find the data that ur saving anymore ?
does this method save external ini file, or actually inside the exe file ? could someone explain this, look below for source code.
does this actually save inside the exe ? and can i add encryption, and will it work ?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Inifiles;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
MyAppini : TIniFile;
begin
try
MyAppini := TIniFile.Create(ExtractFileName(Application.ExeName));
Left := MyAppini.ReadInteger(Caption,'Left',Left);
Top := MyAppini.ReadInteger(Caption,'Top',Top);
Width := MyAppini.ReadInteger(Caption,'Width',Width);
Height := MyAppini.ReadInteger(Caption,'Height',Height);
finally
MyAppini.Free;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
MyAppini : TIniFile;
begin
try
MyAppini := TIniFile.Create(ExtractFileName(Application.ExeName));
MyAppini.WriteInteger(Caption,'Top',Top);
MyAppini.WriteInteger(Caption,'Left',Left);
MyAppini.WriteInteger(Caption,'Width',Width);
MyAppini.WriteInteger(Caption,'Height',Height);
finally
MyAppini.Free;
end;
end;
end.