【问题标题】:Inno Setup - Avoid displaying filenames of sub-installersInno Setup - 避免显示子安装程序的文件名
【发布时间】:2017-03-01 11:57:59
【问题描述】:

我正在尝试使用Inno Setup - How to hide certain filenames while installing? (FilenameLabel)的想法

唯一确定的解决方案是使用 [Files] 部分避免安装您不想显示的文件。而是使用代码安装它们。使用ExtractTemporaryFileFileCopy 函数

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

[Files]
Source: "_Redist\DXWebSetup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

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

如何使用[Files] 部分、ExtractTemporaryFileFileCopy 函数隐藏(安装时,在文件名标签中)?

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

    最简单的方法是放弃标准的[Files][Run] 部分并在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?

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多