2017-03-01 79 views
1

我想使用这个想法从Inno Setup - How to hide certain filenames while installing? (FilenameLabel)Inno Setup的 - 避免显示子安装程序的文件名

唯一确定的解决方案是避免安装文件,你不希望显示,使用[文件] 部分。改为使用代码来安装它们。使用ExtractTemporaryFileFileCopy功能

不过,我想使用在[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功能?

回答

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?

+0

开始删除所有'ProgressPage'代码。相反,请设置'StatusLabel.Caption:='安装DirectX ...';' –

+0

参见[Inno Setup:如何在运行部分上操作进度条?](http://stackoverflow.com/q/34336466/850848 )和[Inno Setup:在\ [Run \]部分执行Pascal功能](Inno Setup:在[Run]部分执行Pascal功能)。 –

+0

请参阅[Inno Setup在自定义页面上放置图像/控件](https://stackoverflow.com/q/43696537/850848)。 –

相关问题