我试图使用
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
ExtractTemporaryFileandFilecopyfunctions
但是我要隐藏的文件在[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]部分,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?