procedure Tsetsys.FormCreate(Sender: TObject);
begin
myinifile:=Tinifile.Create(getCurrentDir+'\system.ini');
edit1.text:=myinifile.ReadString('upload','path','');
label1.Caption:=myinifile.ReadString('upload','path','');
end;procedure Tsetsys.BitBtn1Click(Sender: TObject);
begin
// if not directoryexists(edit1.text) then
if not directoryexists(label1.Caption) then
showmessage('设定的目录不存在!请重新设置!')
else
begin
myinifile.WriteString('upload','path',edit1.text);
myinifile.Destroy;
setsys.Close;
end;
end;
是不是getCurrentDir用的不对啊?该怎么写??
begin
myinifile:=Tinifile.Create(getCurrentDir+'\system.ini');
edit1.text:=myinifile.ReadString('upload','path','');
label1.Caption:=myinifile.ReadString('upload','path','');
end;procedure Tsetsys.BitBtn1Click(Sender: TObject);
begin
// if not directoryexists(edit1.text) then
if not directoryexists(label1.Caption) then
showmessage('设定的目录不存在!请重新设置!')
else
begin
myinifile.WriteString('upload','path',edit1.text);
myinifile.Destroy;
setsys.Close;
end;
end;
是不是getCurrentDir用的不对啊?该怎么写??
directorylistbox的listlabel为label1;选择后自动将路径保存到system.ini
var
myinifile:Tinifile;
改了还不行,可能是我没说明白,我的ini和程序在一个目录理,当我设置好路径保存后,程序就在选择的目录理新建了个ini文件?
简单的解决办法是声明一个成员变量在主form create时,将路径信息保存下来:
如: IniPath := GetCurrentDir;以后再用到ini文件时加上IniPath就ok 了。
我用的 ExtractFilePath(Application.Exename)+'system.ini'