Inno Setup的 - 避免显示子安装程序的文件名
问题描述:
我想使用这个想法从Inno Setup - How to hide certain filenames while installing? (FilenameLabel)Inno Setup的 - 避免显示子安装程序的文件名
唯一确定的解决方案是避免安装文件,你不希望显示,使用[文件] 部分。改为使用代码来安装它们。使用
ExtractTemporaryFile
和FileCopy
功能
不过,我想使用在[Run]
部分隐藏文件:使用[Files]
部分,ExtractTemporaryFile
[Files]
Source: "_Redist\DXWebSetup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
[Run]
Filename: "{tmp}\DXWebSetup.exe"; Components: DirectX; StatusMsg: "Installing DirectX..."; \
BeforeInstall: StartWaitingForDirectXWindow; AfterInstall: StopWaitingForDirectXWindow
如何隐藏(安装时,在filenamelabel)和FileCopy
功能?
答
最简单的是放弃对标准[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?
开始删除所有'ProgressPage'代码。相反,请设置'StatusLabel.Caption:='安装DirectX ...';' –
参见[Inno Setup:如何在运行部分上操作进度条?](http://*.com/q/34336466/850848 )和[Inno Setup:在\ [Run \]部分执行Pascal功能](Inno Setup:在[Run]部分执行Pascal功能)。 –
请参阅[Inno Setup在自定义页面上放置图像/控件](https://*.com/q/43696537/850848)。 –