在Inno Setup中隐藏消息框是什么意思?

问题描述

这是文档SuppressibleMsgBox页面

这是什么意思如果消息框被抑制...

解决方法

引用的部分后面有指向说明的链接:

如果禁止显示消息框(请参见Setup Command Line Parameters),则会返回Default

在链接中记录了/SUPPRESSMSGBOXES commandline parameter

指示安装程序隐藏消息框。仅当与'/ SILENT'或'/ VERYSILENT'组合时才有效。

因此,通常,SuppressibleMsgBox的行为与MsgBox相同。但是,如果您使用/SUPPRESSMSGBOXES参数运行安装程序,则SuppressibleMsgBox不会执行任何操作,只会默默地返回Default参数的值。

函数使用的实际示例:

function NextButtonClick(CurPageID: Integer): Boolean;
var
  Dir: string;
  Msg: string;
begin
  Result := True;
  if CurPageID = wpSelectDir then
  begin
    Dir := WizardForm.DirEdit.Text;
    if Pos(' ',Dir) > 0 then
    begin
      Msg :=
        'It is not recommended to install the application to a path with spaces. ' +
        'Do you want to continue anyway?';
      if SuppressibleMsgBox(Msg,mbInformation,MB_YESNO,IDYES) = IDNO then
      begin
        Result := False;
      end;
    end;
  end;
end;

在交互式安装中,如果用户尝试安装到带空格的路径,安装程序将发出警告。但是,如果要使用/SILENT /SUPPRESSMSGBOXES自动执行静默安装,安装程序将继续进行。

每当您不希望特定消息中断静默安装时,最好使用SuppressibleMsgBox。因此,在大多数情况下。