WriteEdit()ReadEdit() IniFiles
uses IniFiles;//引用IniFiles
{$R *.dfm}
{写入信息到ini文件 }
//WriteEdit('Config.ini','Options','Edit',Edit1);
procedure WriteEdit(fileName:string;section:string;Ident:string;Edit:TEdit);
var INIFILE: TIniFile;
begin
INIFILE:=TIniFile.Create(ExtractFilePath(Application.ExeName)+fileName);
try
INIFILE.WriteString(section,Ident,Edit.Text);
Finally
INIFILE.Free;
end;
end;
{从Ini读取信息并赋值}
//ReadEdit('Config.ini','Options','Edit',Edit1);
procedure ReadEdit(fileName:string;section:string;Ident:string;Edit:TEdit);
var
INIFILE: TIniFile;
begin
INIFILE :=TIniFile.Create(ExtractFilePath(Application.ExeName)+fileName);
try
Edit.text:= INIFILE.ReadString(section,Ident,'');
Finally
INIFILE.Free;
end;
end;
{$R *.dfm}
{写入信息到ini文件 }
//WriteEdit('Config.ini','Options','Edit',Edit1);
procedure WriteEdit(fileName:string;section:string;Ident:string;Edit:TEdit);
var INIFILE: TIniFile;
begin
INIFILE:=TIniFile.Create(ExtractFilePath(Application.ExeName)+fileName);
try
INIFILE.WriteString(section,Ident,Edit.Text);
Finally
INIFILE.Free;
end;
end;
{从Ini读取信息并赋值}
//ReadEdit('Config.ini','Options','Edit',Edit1);
procedure ReadEdit(fileName:string;section:string;Ident:string;Edit:TEdit);
var
INIFILE: TIniFile;
begin
INIFILE :=TIniFile.Create(ExtractFilePath(Application.ExeName)+fileName);
try
Edit.text:= INIFILE.ReadString(section,Ident,'');
Finally
INIFILE.Free;
end;
end;