本文介绍了如何在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);

我想让网址成为网页的超链接,但我无法弄清楚如何在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的包装器功能,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中显示超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 04:16
查看更多