procedure TForm1.FormShow(Sender: TObject);
begin
S1 := ExtractFilePath(Application.ExeName)+'AutoPath.ini';
MyIni := TIniFile.Create(S1);
MyIni.ReadSectionValues('Tools', Listbox1.Items);
MyIni.Free;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
S : String;
I : Integer;
begin
if OpenDialog1.Execute then
begin
S := ExtractFileName(OpenDialog1.FileName); // 取程序名
I := Length(ExtractFileExt(OpenDialog1.FileName)); //取程序扩展名
Edit1.Text := Copy(S,1,Length(S)-I); //删除程序扩展名并在edit1中显示
Edit2.Text := OpenDialog1.FileName;
end
else Exit;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if (edit1.Text = '') or (edit2.Text = '') then exit;
MyIni := TIniFile.Create(S1);
MyIni.WriteString('Tools', Edit1.Text, Edit2.Text);
edit1.Clear;
edit2.Clear;
MyIni.Free;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
s:= listbox1.Items.Names[listbox1.Itemindex]; //获取名称
// s1:= listbox1.Items.Values[listbox1.Items.Names[listbox1.ItemIndex]] ; // 获取程序名称
MyIni := TIniFile.Create(S1);
MyIni.DeleteKey('Tools', s);
MyIni.Free;
listbox1.Items.Clear;
end;
OD工具管理(INI文件操作)
最新推荐文章于 2023-03-21 17:44:50 发布