如何把ini文件中一个键值下的所有分支内容读到ListBox1中?
FileCopy.ini文件中的内容:
[FilePath]
Path0=D:\新建文件夹
Path1=D:\五笔安装
...
如何把
D:\新建文件夹
D:\五笔安装
...
读到ListBox1中?
[解决办法]
var
Keys:TStringList;
ini:TIniFile;
i:Integer;
begin
Keys:=TStringList.Create;
Ini:=TIniFile.Create( 'FileCopy.ini路径 ');
Ini.ReadSection( 'FilePath ',Keys);
for i:=0 to Keys.Items.Count-1 do
begin
ListBox1.Items.Add(Ini.ReadString( 'FilePath ',Keys.String[i], ' ');
end;
Ini.Free;
Keys.Free;
end;
//代码自己测试
[解决办法]
或者你用一个Key保存路径数也可以