加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

inno-setup – Inno Setup – 避免显示子安装程序的文件名

发布时间:2020-12-15 10:04:59 所属栏目:大数据 来源:网络整理
导读:我试图使用 Inno Setup – How to hide certain filenames while installing? (FilenameLabel)的想法 The only sure solution is to avoid installing the files,you do not want to show,using the [Files] section. Install them using a code instead. Us
我试图使用 Inno Setup – How to hide certain filenames while installing? (FilenameLabel)的想法

The only sure solution is to avoid installing the files,you do not want to show,using the [Files] section. Install them using a code instead. Use the ExtractTemporaryFile and FileCopy functions

但是我要隐藏的文件在[Run]部分中使用:

[Files]
Source: "_RedistDXWebSetup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

[Run]
Filename: "{tmp}DXWebSetup.exe"; Components: DirectX; StatusMsg: "Installing DirectX..."; 
  BeforeInstall: StartWaitingForDirectXWindow; AfterInstall: StopWaitingForDirectXWindow

如何使用[Files]部分,ExtractTemporaryFile和FileCopy函数隐藏(在filenamelabel中安装时)?

解决方法

最简单的是放弃标准的[文件]和[运行]部分,并在 CurStepChanged event fuction中自行编码:
[Files]
Source: "dxwebsetup.exe"; Flags: dontcopy

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
var
  ProgressPage: TOutputProgressWizardPage;
  ResultCode: Integer;
begin
  if CurStep = ssInstall then { or maybe ssPostInstall }
  begin
    if IsComponentSelected('DirectX') then
    begin
      ProgressPage := CreateOutputProgressPage('Installing prerequsities','');
      ProgressPage.SetText('Installing DirectX...','');
      ProgressPage.Show;
      try
        ExtractTemporaryFile('dxwebsetup.exe');
        StartWaitingForDirectXWindow;
        Exec(ExpandConstant('{tmp}dxwebsetup.exe'),'',SW_SHOW,ewWaitUntilTerminated,ResultCode);
      finally
        StopWaitingForDirectXWindow;
        ProgressPage.Hide;
      end;
    end;
  end;
end;

这甚至让您有机会检查子安装程序的结果.你可以,例如当子安装程序失败或被取消时,防止安装继续.

然后使用PrepareToInstall而不是CurStepChanged更容易.

另一种选择是在提取子安装程序时显示自定义标签.
见Inno Setup – How to create a personalized FilenameLabel with the names I want?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读