Custom installation step
by overwriting function InitializeSetup (): Boolean; to implement custom installation,
to be noted that this method, if the return value is false, then the installation procedure terminates subsequentReturn value
The return value is agreed Result- Automatically installed
in [the Run] added to the configuration node configured to be installed
Example:
Filename: {tmp}\vc_redist_x86.exe; Parameters: "/q:a /c:""install /l /q"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installing Microsoft Visual C++ Runtime ..."
Custom code
add custom methods [Code] configurationDetecting the presence or absence registry
important
According to 24K pure open source articles that
64-bit systems need to change the original HKLM HKLM64
//检测vs++2015
Result:=RegValueExists(HKLM64, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86', 'Version');
//检测.netframeword4.5.2
Result:=RegValueExists(HKLM64, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version');
- Define exit the installer script
// ss
procedure ExitProcess(exitCode:integer);
external '[email protected] stdcall';
- The resource release to a temporary directory and call the
resource first defined in [Files] required in
cases of:
Source: "C:\Users\ives\Desktop\Output\vc_redist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion;
Add the script required for detection, as defined in [code] in
function IsVC2015():boolean;
var
version: Cardinal;
begin
Result:=RegValueExists(HKLM64, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86', 'Version');
end;
The last call InitializeSetup mentioned above
function InitializeSetup(): Boolean;
var Path:string;
ResultCode: Integer;
begin
//检测vc++2015
if (IsVC2015()=false) then
begin
if MsgBox('正在安装必备组件vc_redist_x86,请稍后……', mbConfirmation, MB_YESNO) = idYes then
begin
ExtractTemporaryFile('vc_redist_x86.exe');
Exec(ExpandConstant('{tmp}\vc_redist_x86.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
Result:=true
end;