Advertisement
TLama

Untitled

Jun 12th, 2015
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.08 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Files]
  7. ; dontcopy flag tells the installer to not copy the file during installation
  8. Source: "D:\vcredist_x64.exe"; Flags: dontcopy
  9.  
  10. [Tasks]
  11. Name: vcredist_x64; Description: Install Visual C++; Flags: unchecked
  12.  
  13. [Code]
  14. function PrepareToInstall(var NeedsRestart: Boolean): string;
  15. var
  16.   ResultCode: Integer;
  17. begin
  18.   // if the task for this installer is checked, then...
  19.   if IsTaskSelected('vcredist_x64') then
  20.   begin
  21.     // extract the file from the setup archive to the temporary folder
  22.     ExtractTemporaryFile('vcredist_x64.exe');
  23.     // execute the extracted file; if the execution failed, return an error message to stop the installation
  24.     if not Exec(ExpandConstant('{tmp}\vcredist_x64.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
  25.     begin
  26.       Result := Format('Installing VC++ redist failed with code %d.', [ResultCode]);
  27.       Exit;
  28.     end;
  29.   end;
  30.  
  31.   // you can repeat the similar code for other installers, or better make some common function for this code block
  32. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement