首页 > 解决方案 > 基本或高级安装模式选择以跳过或使用高级选项页面

问题描述

我有一个基于 Inno Setup 的安装程序,它安装了三个应用程序,分为两个组件。现在安装程序询问用户安装目录和要安装的组件。

我想更改安装程序添加这个新选择:

作为首选。

如果用户选择基本模式,安装程序应该跳过路径和组件选择,只使用默认值进行安装。

如果用户选择高级模式,安装程序的行为应该像现在一样。

有一种方法可以使用 Inno Setup 来实现吗?

标签: windowsinstallationinno-setup

解决方案


CreateInputOptionPage使用功能为您的“模式”选择创建自定义选项页面。并实现ShouldSkipPage事件功能以在选择“基本”模式时跳过页面。

[Code]
var
  ModePage: TInputOptionWizardPage;

procedure InitializeWizard();
begin
  ModePage :=
    CreateInputOptionPage(
      wpWelcome, 'Installation mode', 'Select installation mode', '', True, False);
  ModePage.Add('Basic mode');
  ModePage.Add('Advanced mode');
  ModePage.Values[0] := True; { Select Basic mode by default }
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  { If "Basic" mode is selected, skip Directory and Components pages }
  Result := 
    ModePage.Values[0] and
    ((PageID = wpSelectDir) or (PageID = wpSelectComponents));
end;

在此处输入图像描述


推荐阅读