杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2166|回复: 0

Inno Setup 新文件替换原文件

[复制链接]
发表于 2017-3-6 18:20:36 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. #define MyAppName "我的程序"

  2. [Setup]
  3. AppName={#MyAppName}
  4. AppVersion=1.0
  5. UsePreviousAppDir=yes
  6. DefaultDirName={reg:HKLM\Software\Cleanse,InstPath|{pf}\{#MyAppName}}
  7. Uninstallable=false
  8. OutputDir=d:\My Documents\新建文件夹
  9. Compression=lzma
  10. SolidCompression=yes
  11. DirExistsWarning=no


  12. [Languages]
  13. Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

  14. [Files]
  15. Source: "D:\视频缓存提取工具\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

  16. [code]
  17. var
  18.   OldPrgInstalled: boolean;
  19.   OldPrgPath: string;
  20. function InitializeSetup(): Boolean;
  21. begin
  22.   Result := true;
  23.   OldPrgInstalled := false;
  24.   if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Cleanse', 'InstPath', OldPrgPath) then
  25.     if FileExists(OldPrgPath+'\MyProg.exe') then
  26.       OldPrgInstalled := true;
  27. end;

  28. function ShouldSkipPage(PageID: Integer): Boolean;
  29. begin
  30.   result := false;
  31.   if PageID = wpSelectDir then
  32.     result := OldPrgInstalled;
  33. end;

  34. function NextButtonClick(CurPageID: Integer): Boolean;
  35. begin
  36.   Result:= true;
  37.   if (CurPageID = wpSelectDir) and (not FileExists(ExpandConstant('{app}\MyProg.exe'))) then
  38.     begin
  39.       Result := false;
  40.       MsgBox('你选择的目录没有需要补丁的程序,请选择正确的目录!', mbInformation, MB_OK);
  41.     end;
  42. end;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 20:03 , Processed in 0.115081 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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