Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Setup]
- AppName=My Program
- AppVersion=1.5
- DefaultDirName={pf}\My Program
- [Files]
- Source: ".\SystemFiles\vcredist_x86.exe"; Flags: dontcopy
- [Code]
- function IsRuntimeInstalled: Boolean;
- begin
- Result := False;
- // here will be a statement that will check whether the runtime is installed
- // and return True if so; see e.g. http://stackoverflow.com/q/11137424/960757
- end;
- function PrepareToInstall(var NeedsRestart: Boolean): string;
- var
- ExitCode: Integer;
- begin
- // if the runtime is not already installed
- if not IsRuntimeInstalled then
- begin
- // extract the redist to the temporary folder
- ExtractTemporaryFile('vcredist_x86.exe');
- // run the redist from the temp folder; if that fails, return from this handler the error text
- if not Exec(ExpandConstant('{tmp}\vcredist_x86.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ExitCode) then
- begin
- // return the error text
- Result := 'Setup failed to install VC++ runtime. Exit code: ' + IntToStr(ExitCode);
- // exit this function; this makes sense only if there are further prerequisites to install; in this
- // particular example it does nothing because the function exits anyway, so it is pointless here
- Exit;
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement