看流星社区

 找回密码
 注册账号
查看: 3055|回复: 1

[Delphi] DELPHI遍历修改INI文件

[复制链接]

该用户从未签到

发表于 2013-5-11 09:04:38 | 显示全部楼层 |阅读模式
procedure SetStartPage_Ex(Apath: string; FileName: string);
var
  IniFile: TIniFile;

  procedure FindAll(Path: string);
  var
    Sr: TSearchRec;
    Fr: Integer;
    Temp_str, Str, ExePath: string;
    I: Integer;
  begin
    if rightStr(trim(Path), 1) <> '\' then
      Path := Trim(Path) + '\'
    else
      Path := Trim(Path);

    if not DirectoryExists(Path) then
      Exit;


    Fr := FindFirst(Path + '*.*', faAnyFile, Sr);
    while Fr = 0 do
    begin
      if (Sr.Attr = faDirectory) and (Sr.Name <> '.') and (Sr.Name <> '..') then
        FindAll(Path + '' + sr.Name)
      else if (Sr.Name <> '.') and (Sr.Name <> '..') then
      begin
        if (Sr.Name = FileName) then
        begin
          IniFile := TIniFile.Create(Path + Sr.Name);
          try
            IniFile.WriteString('', '', ' ');
          finally
            IniFile.Free;
          end;
        end;
      end;
      Temp_str := Sr.name;
      FindNext(sr);
      if Temp_str = Sr.Name then
        break;
    end;
    FindClose(Sr);
  end;

begin
  FindAll(Apath);
end;

该用户从未签到

发表于 2013-5-24 22:27:35 | 显示全部楼层
什么我不明白啊
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-4-18 10:00

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表