正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- [Setup]
- AppName=我的程序
- AppVerName=我的程序 版本 1.5
- DefaultDirName={pf}\我的程序
- DefaultGroupName=我的程序
- [Code]
- var sDir: string;
- filefounded: boolean;
- procedure RecursiveFileSearch(BeginDir, FilePattern: string);
- var FR: TFindRec;
- begin
- if FindFirst(BeginDir+'\'+FilePattern, FR) then begin //搜索目录中的文件
- try
- repeat
- if FR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
- begin
- sDir:= BeginDir;
- filefounded:= true;
- Exit;
- end
- until not FindNext(FR);
- finally
- FindClose(FR);
- end;
- end;
-
- if FindFirst(BeginDir+'\*', FR) then begin //搜索目录中的子目录
- try
- repeat
- if (FR.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and (FR.Name<>'.') and (FR.Name<>'..') then
- RecursiveFileSearch(BeginDir+'\'+FR.Name, FilePattern); //在子目录中继续搜索文件
- until not FindNext(FR);
- finally
- FindClose(FR);
- end;
- end;
- end;
- procedure InitializeWizard ();
- begin
- sDir:= '';
- filefounded:= false;
- RecursiveFileSearch('E:\', '自定义窗口.iss'); // 开始搜寻的位置以及要搜寻的文件名
- if filefounded then
- if MsgBox('找到文件在: ' + sDir + #10#13 + '你想要删除该文件夹吗?', mbConfirmation, MB_YESNO) = IDYES then
- DelTree(sDir, true, true, true);
- end;
复制代码
|