The AppName
directive在the InitializeSetup
(如果有)完成後立即解決數值(=您的GetAppName
)。這是很久之前用戶能夠更改組件。
所以你不能讓AppName
取決於選定的組件。
AppName
的某些用途雖然可以用自定義值覆蓋,但不是全部。 見下文。
雖然,我知道你的問題其實是關於安裝類型,你可以這樣做:
- 創建自定義的「類型」頁面(如菜單)。因爲第一個。
- 一旦用戶選擇「類型」,用自定義開關(例如
/APPTYPE=slasher
)重新啓動安裝程序並退出。
- 一旦安裝程序(重新)與
/APPTYPE
一起運行,從一開始就知道您正在安裝什麼組件/類型,因此您可以正常設置AppName
。
- 當然,您可以跳過自定義「類型」頁面。
這實際上是一種更簡單的實現方式。唯一的缺點是在用戶選擇「類型」之後,設置窗口被「重新創建」。
這是您不想使用上述解決方案時的原始響應。
首先,你的執行GetAppName
是錯誤的。您正在使用未初始化的變量CurPageID
。無論如何,如前所述,甚至在創建嚮導窗口之前調用GetAppName
,所以「當前頁面」在這裏是無關緊要的。
正確的實現將是這樣的:
function GetAppName(Value: string): string;
begin
if IsComponentSelected('Slasher') and not IsComponentSelected('Frankenstein') then
begin
Result := 'Dagon Slasher';
end
else
if IsComponentSelected('Frankenstein') and not IsComponentSelected('Slasher') then
begin
Result := 'Dagon Frankenstein';
end
else
begin
Result := 'Dagon Video Tools';
end;
end;
但是,這仍然不會使它在AppName
指令工作。儘管稍後我們會在其他情況下使用它。
另請注意,your specific installer,你應該更好地利用the WizardSetupType(false)
function代替IsComponentSelected
。
FinishedLabel
只是覆蓋CurPageChanged(wpFinished)
的Inno Setup的默認文本:
procedure CurPageChanged(CurPageID: Integer);
var
S: string;
begin
if CurPageID = wpFinished then
begin
S := SetupMessage(msgFinishedHeadingLabel);
StringChange(S, '[name]', GetAppName(''));
WizardForm.FinishedHeadingLabel.Caption := S;
WizardForm.AdjustLabelHeight(WizardForm.FinishedHeadingLabel);
// Ideally we should shift the FinishedLabel up or down here,
// if the height of the header changed.
// Note that other messages (msgFinishedLabelNoIcons or msgFinishedRestartLabel)
// are used in special situations, so this is not a complete solution.
S := SetupMessage(msgFinishedLabel);
StringChange(S, '[name]', GetAppName(''));
WizardForm.FinishedLabel.Caption := S;
WizardForm.AdjustLabelHeight(WizardForm.FinishedLabel);
end;
end;
添加/刪除程序
這很簡單。這裏有the UninstallDisplayName
directive,只有在實際安裝期間,我們已經知道所選組件時才解決該問題。因此,我們可以使用(固定)GetAppName
這裏:
[Setup]
UninstallDisplayName={code:GetAppName}
您確定要完全刪除AppName
和它的所有組件?
你不能改變這一點。您最好在AppName
中使用一些通用名稱,以便此消息適用於任何組件。
,或使消息並不提到的應用程序名稱:
[Messages]
ConfirmUninstall=Are you sure you want to completely remove this game?
或者完全刪除消息:
Can I disable uninstall confirmation message?
和任選與the InitializeUninstall
event function實現自己的消息替換它。
請稍候,AppName
從您的計算機
同樣的解決方案作爲WizardForm.FinishedLabel
刪除。請使用the InitializeUninstallProgressForm
的UninstallProgressForm.PageDescriptionLabel
。
AppName
已成功從您的計算機中刪除
類似與「你確定要完全刪除AppName
和它的所有組件?」
要麼使AppName
通用。或者用「無聲」模式禁用消息並在the CurUninstallStepChanged(usPostUninstall)
中實現您自己的消息。
有關類似的討論,請參閱Changing AppName and AppDir depending on language in Inno Setup。
窗口標題 - 不要緊, FinishedLabel - 最好, 整個卸載過程 - 應該改變, 添加/刪除程序 - 應改爲 –