var
IniPath:string;
MyFile:TIniFile;
begin
//ini文件放在应用程序目录下的ini文件夹下
IniPath:=ExtractFilePaht(Application.ExeName)+'ini\'+'Myini.ini';
try
MyFile:=TiniFile.Create(IniPath)
with MyFile do
begin
Readstring('xxx','xxx',xxx);
........
end;
finally
Myfile.free;
end;
end;
var ss :string;
dir : string;
fini : TIniFile;
begin
ss := GetCurrentDir;
dir := ss+'\Setup'+IntToStr(File_Name)+'.ini';
fini := Tinifile.create(dir);
ss := fini.readstring('option','keyname','');
....
fini.free;
var
AIniFile:TIniFile;
IniFileName:string;
CurrDir:string;
begin
GetDir(0,CurrDir);
AIniFile := TIniFile.Create(CurrDir+'\'+IniFileName);
try
with AIniFile do
begin
//Read operation
end;
finally
AIniFile.Destroy;
end;
var
IniFile:TIniFile;
IniFileName:string;
TempDir:string;
begin
TempDir:= ExtractFilePath(Application.ExeName);
IniFileName:=TempDIr + '\Config.Ini';
IniFile := TIniFile.Create(IniFileName);
With IniFile Do Begin
XX:=IniFile.ReadString('节名称','值名称','默认值');
End;
IniFile.Free;
end;