Inno Setup-避免显示子安装程序的文件名 [英] Inno Setup - Avoid displaying filenames of sub-installers

查看:111
本文介绍了Inno Setup-避免显示子安装程序的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Inno Setup中的想法-如何在安装时隐藏某些文件名? (文件名标签)

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

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

But the files that I want to hide are using in the [Run] Section:

[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函数隐藏(安装时,在文件名标签中)?

How to hide (while installing, in filenamelabel) using [Files] section, ExtractTemporaryFile and FileCopy functions?

推荐答案

最简单的方法是放弃标准的[Files][Run]部分,并在

The easiest is to give up on the standard [Files] and [Run] sections and code everything on your own in the 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;


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


This even gives you a chance to check for results of the sub-installer. And you can e.g. prevent the installation from continuing, when the sub-installer fails or is cancelled.

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

另一种选择是在解压缩子安装程序时显示自定义标签.
请参见 Inno设置-如何使用我想要的名称创建个性化FilenameLabel?

Another option is to display a custom label, while extracting the sub-installer.
See Inno Setup - How to create a personalized FilenameLabel with the names I want?

这篇关于Inno Setup-避免显示子安装程序的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆