|
对
象,该对象用来读写d:\ucdos目录中的rdfnt.ini文件,
如果读写的文件在Windows的目录里(如system.ini),
则可以直接写文件名而不必指定路径 }
IniFile:=TIniFile.Create(''''d:\ucdos\rdfnt.ini'''');
{ 将TIniFile对象关联的初始化文件system.ini中的所
有节(即用[]括号括起的那部分)的节名送入下拉式组
合列表框SectionComboBox中 }
SectionComboBox.Clear;
IniFile.ReadSections(SectionComboBox.Items);
{ 选择system.ini文件的第一个节名 }
SectionComboBox.ItemIndex:=0;
SectionComboBoxChange(Sender);
CmdSave.Enabled:=False;
end;
{ 将组合列表框IniComboBox中所选择节中对应的各个
变量及对应的值送入多行文本编辑器IniMemo中 }
procedure TIniForm.SectionComboBoxChange(Sender: TObject);
begin
IdentComboBox.Clear;
IniFile.ReadSection(SectionComboBox.Text,
IdentComboBox.Items);
IdentComboBox.ItemIndex:=0;
IdentComboBoxChange(Sender);
end;
procedure TIniForm.IdentComboBoxChange(Sender: TObject);
begin
IdentValueEdit.Enabled:=False;
{ 将选择的关键字值读入 }
IdentValueEdit.Text:=
IniFile.ReadString(SectionComboBox.Text,
IdentComboBox.Text,'''''''');
end;
procedure TIniForm.CmdChangClick(Sender: TObject);
begin
CmdSave.Enabled:=True;
IdentValueEdit.Enabled:=True;
IdentValueEdit.SetFocus;
end;
procedure TIniForm.CmdSaveClick(Sender: TObject);
begin
if IdentValueEdit.Modified then begin
IniFile.WriteString(SectionComboBox.Text,
IdentComboBox.Text,
IdentValueEdit.Text);
end;
IdentValueEdit.Enabled:=False;
CmdSave.Enabled:=False;
end;
procedure TIniForm.FormDestroy(Sender: TObject);
begin
IniFile.Free; { 释放创建的对象 }
end;
end. 以上方法在Windows 95下用Delphi 3.0调试通过。
上一页 [1] [2] [聊天工具]解读珊瑚虫CoralQQ.ini代码的秘密 [系统软件]解析boot.ini文件,亲身经验 [VB.NET程序]VB源码推荐:一个操作Ini文件的类 [VB.NET程序]在VB6中用WINDOWS API函数读写INI文件 [Delphi程序]delphi读取ini文件 [Delphi程序]INI文件的读写
|