如何在 Inno Setup 中显示超链接? [英] How to show a hyperlink in Inno Setup?

查看:42
本文介绍了如何在 Inno Setup 中显示超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm making a validation in my Inno Setup installer to check whether or not a Microsoft update is installed on the machine, if not, I'm showing a simple message box telling the user that the update is required, this is the message code:

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 中添加文本作为超链接?

I want to make the URL an hyperlink to the web page, but I haven't been able to figure it out how, it is possible in Inno Setup to add text as an hyperlink?

谢谢.

推荐答案

Inno Setup 中的 MsgBox() 函数是标准 Windows MessageBox() 函数,AFAIK 不支持嵌入链接,因此无法简单地在此处显示链接.

The MsgBox() function in Inno Setup is a wrapper for the standard Windows MessageBox() function, which AFAIK doesn't support embedded links, so it's not possible to simply show the link there.

然而,您可以做的是通知用户需要更新,并询问他们是否在默认浏览器中打开链接.类似的东西:

What you could do however is to notify the user that the update is required, and ask them whether to open the link in the default browser. Something like:

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;

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

This code will abort the installation, but you could create a custom page instead which checks whether the update has been installed, and otherwise prevents navigation to the next page. This would only work if the update can be installed without a system restart, though.

这篇关于如何在 Inno Setup 中显示超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆