12

我正在我的 Inno Setup 安装程序中进行验证,以检查机器上是否安装了 Microsoft 更新,如果没有,我将显示一个简单的消息框,告诉用户需要更新,这是消息代码:

MsgBox(
  'Your system requires an update supplied by Microsoft. ' +
  'Please follow this link to install it: ' + 
  'http://www.microsoft.com/downloads/details.aspx?FamilyID=1B0BFB35-C252-43CC-8A2A-6A64D6AC4670&displaylang=en',
  mbInformation, MB_OK);

我想让 URL 成为网页的超链接,但我无法弄清楚如何在 Inno Setup 中将文本添加为​​超链接?

谢谢。

4

1 回答 1

16

Inno Setup 中的MsgBox()函数是标准 WindowsMessageBox()函数的包装器,AFAIK 不支持嵌入式链接,因此无法简单地在那里显示链接。

但是,您可以做的是通知用户需要更新,并询问他们是否在默认浏览器中打开链接。就像是:

function InitializeSetup(): Boolean;
var
  ErrCode: integer;
begin
  if MsgBox('Your system requires an update supplied by Microsoft. Would you like to visit the download page now?', mbConfirmation, MB_YESNO) = IDYES
  then begin
    ShellExec('open', 'http://www.microsoft.com/downloads/details.aspx?FamilyID=1B0BFB35-C252-43CC-8A2A-6A64D6AC4670&displaylang=en',
      '', '', SW_SHOW, ewNoWait, ErrCode);
  end;
  Result := False;
end;

此代码将中止安装,但您可以创建一个自定义页面来检查是否已安装更新,否则会阻止导航到下一页。但是,这仅在无需重新启动系统即可安装更新的情况下才有效。

于 2009-10-12T10:27:34.670 回答