unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, [这里必须引用inifiles],StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ok:tinifile;
begin
ok:=tinifile.Create('ok.ini');
ok.WriteString('form','caption',edit1.text);
ok.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var ok:tinifile;
begin
ok:=tinifile.Create('ok.ini');
form1.Caption:=ok.ReadString('form','caption','');
ok.free;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, [这里必须引用inifiles],StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ok:tinifile;
begin
ok:=tinifile.Create('ok.ini');
ok.WriteString('form','caption',edit1.text);
ok.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var ok:tinifile;
begin
ok:=tinifile.Create('ok.ini');
form1.Caption:=ok.ReadString('form','caption','');
ok.free;
end;
end.