How to show a hyperlink in Inno Setup?

和自甴很熟 提交于 2019-12-18 19:32:49

问题


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);

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?

Thanks.


回答1:


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.



来源:https://stackoverflow.com/questions/1493198/how-to-show-a-hyperlink-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!