0

I am trying to make my Inno Setup program to run this command steam://

This command is used to open Steam program via the windows RUN tool.

I press WindowsKey+R and type the command steam:// and it opens the Steam program.

How can i make Inno Setup call this command?

I tried the following without success:

[Run]
Filename: "C:\Users\LUCAS\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Run.lnk"; Parameters: "steam://;

also tried that code bellow, and calling AfterInstall: RunOtherInstaller; on [Files] section, but it gives error on installation: %1 is not a valid Win32 application

[Code]
procedure RunOtherInstaller;
var
  ResultCode: Integer;
begin
  if not Exec(ExpandConstant('C:\Users\LUCAS\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Run.lnk'), 'steam://', '', SW_SHOWNORMAL,
    ewWaitUntilTerminated, ResultCode)
  then
    MsgBox('Error!!' + #13#10 +
      SysErrorMessage(ResultCode), mbError, MB_OK);
end;

This link is a little strange... It actually points to nowhere when i try to follow it, but it is what calls the windows RUN tool.

I know i could call the Steam.exe from the default folder C:\Program Files (x86)\Steam\Steam.exe but i am trying to avoid problems with users who not have Steam on default folder... So i am trying to use this method running this "External Protocol" (i dont know if this is the right name for it): steam://

Lucas Matos
  • 1,112
  • 5
  • 25
  • 42

2 Answers2

0

You can check registry for Steam location. Part of my script for triggering installation:

[Code]
function SteamNotInstalled(): Boolean;
var 
Path: String;
ErrorCode: Integer;
begin
  Result := True;
  if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Valve\Steam',
     'InstallPath', Path)) and (FileExists(Path + '\Steam.exe')) then begin
              ShellExec('', ExpandConstant('"' + Path + '\Steam.exe' + '"'), ' -install' + ExpandConstant(' "{src}"'),
              '', SW_SHOW, ewNoWait, ErrorCode);
              Result := False;
  end;
end;

Or you can use shellexec in [Run] section

RobeN
  • 5,346
  • 1
  • 33
  • 50
0

You can open the steam:// URL as any other URL.

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

Or use postinstall [Run] section entry:

[Run]
Filename: steam://xxx; Description: "Run game"; Flags: postinstall shellexec

See also

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992