unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, iniFiles, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ini : TiniFile;
//ini variable
begin
ini := TiniFile.Create(ExtractFilePath(ParamStr(0))+'
bin/'+'
config.ini');
//ini erstellen
try
begin
Edit1.Text := ini.ReadString('
NAME', '
Hans', '
');
//String wird ausgelesen und in Edit eingetragen
finally
ini.Free;
//ini schließen
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var ini : TiniFile;
//ini variable
begin
ini := TiniFile.Create(ExtractFilePath(ParamStr(0))+'
bin/'+'
config.ini');
//ini erstellen
try
begin
ini.WriteString('
[NAME]', '
Hans', '
Peter');
//String wird geschrieben
finally
ini.Free;
//ini schließen
end;
end;
end.