14

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Vic
  • 2,878
  • 4
  • 36
  • 55

1 Answers1

17

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.

mghie
  • 32,028
  • 6
  • 87
  • 129
  • 1
    The provided answer works fine on Windows 7 but not on Windows 8 (not with my setup at least). I had to change `ShellExec` to `ShellExecAsOriginalUser`. – Jens Holst Schumacher Sep 21 '12 at 14:07
  • @JensHolstSchumacher: Thank you, You can edit the answer with that extar info as well which will then be approved by a more experianced user. – Deanna Sep 24 '12 at 10:06
  • @JensHolstSchumacher do you know if thats still the case? I would test, but I dont have Windows 8 – traveler3468 Jul 11 '18 at 08:56