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

前端之家收集整理的这篇文章主要介绍了inno-setup – Inno Setup – 避免显示子安装程序的文件名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图使用 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: "_Redist\DXWebSetup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

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

如何使用[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;@H_301_13@ 
 

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

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

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

原文链接:https://www.f2er.com/delphi/102963.html

猜你在找的Delphi相关文章