2017-03-01 76 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)。 –

相關問題