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 - 最好, 整个卸载过程 - 应该改变, 添加/删除程序 - 应改为 –