0

Inno Setup Compiler: How to auto start the default browser with given url? is not what I am wanting for. How / what code in Inno Setup when I want my setup.exe that if it's closed / finished / uninstalled, it will go to a certain site.

Community
  • 1
  • 1
DDoS
  • 361
  • 3
  • 13

1 Answers1

1

To open a web browser from a Pascal Script use a function like this:

procedure OpenBrowser(Url: string);
var
  ErrorCode: Integer;
begin
  ShellExec('open', Url, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;

To trigger it, when installer closes, you can use the CurStepChanged(ssDone) event:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssDone then
  begin
    OpenBrowser('https://www.example.com/');
  end;
end;

Similarly for an uninstaller, use the CurUninstallStepChanged(usDone) event:

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usDone then
  begin
    OpenBrowser('https://www.example.com/');
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992