Inno设置 - 显示警告页面

Fid*_*ius 4 inno-setup

我正在使用Inno Script Studio来构建安装程序,到目前为止,Inno Setup是一个很棒的软件包.

但是,我想添加一个警告页面,当用户取消选中一个重要的任务时会显示该页面.我认为这只是一个简单的检查.经过一些谷歌搜索,我意识到这将需要一些Pascal脚本 - 我不幸的是不知道(下面的证据)......

begin
  if not IsTaskSelected('ImportantTask') then
    WarningPage := CreateOutputMsgPage(wpSelectTasks, 'Caution',
    'Please read the following important information before continuing.',
    'You have not selected the ImportantTask option. Click "Back" to
    reselect ImportantTask, or click "Next" to continue at your own risk.');
  end;
Run Code Online (Sandbox Code Playgroud)

不出所料,这不起作用.


以下是要求:

  • 默认情况下要检查ImportantTask.
  • 如果未选中ImportantTask,则显示带风险确认的WarningPage复选框.
  • 如果未选中风险确认复选框,请禁用" 下一步"按钮.

我不想最终得到一个大的[Code]部分,但可能没有其他选择.
在此先感谢您的帮助.

Gan*_*har 6

使用msgbox而不是向导页面.Msgbox特别用于向用户提供任何指示(info,warning..etc)..
此脚本可根据您的要求运行.

[Setup]
AppName=MySetup 
AppVersion=1.5
DefaultDirName={pf}\MySetup 
[Tasks]
Name: "ImportantTask"; Description: "This task should be selected"; GroupDescription: "Important tasks";
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
  Result := True;
  if (CurPageID = wpSelectTasks) and not IsTaskSelected('ImportantTask') then
    Result := Msgbox('You have not selected the ImportantTask option.' + #13#10 + 
      'Are you sure you want to continue ?', mbInformation, MB_YESNO) = IDYES;
end;
Run Code Online (Sandbox Code Playgroud)

信用去TLama ......