, InitializeWizard() .net-, , , -, - , , , , , .
In addition, keep in mind that some installers of the .NET Framework may need to reboot after installation, in which case you can also include the key in the registry under the startup or startup keys so that your installer receives after reboot (in case the user decided to restart immediately after installation).
Here is an example:
function CheckIfFrameworkNeeded(): Boolean;
var
VersionFrameWork: Cardinal;
FrameWorkNeeded: Boolean;
begin
FrameWorkNeeded := true;
if (RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', VersionFrameWork)) then
begin
if (VersionFrameWork = 1) then
FrameWorkNeeded := false
end;
Result := FrameWorkNeeded;
end;
function Install_NETFramework() : Integer;
var
hWnd: Integer;
ResultCode: Integer;
dotnetRedistPath: string;
outVar : string;
begin
dotnetRedistPath:= ExpandConstant('{tmp}\dotnetfx35setup.exe');
if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
case ResultCode of
1641:
begin
Result := 1;
end
3010, 0:
begin
Result := 0;
end else
begin
Result := -1;
end
end;
end else
begin
Result := -1;
end;
end;
procedure InitializeWizard();
var
frameworkNeeded: Boolean;
installerPath: String;
res: integer;
begin
frameworkNeeded := CheckIfFrameworkNeeded();
if (frameworkNeeded = true)then
begin
if MsgBox('This setup requires the .NET Framework 3.5.'
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'MyAppKey', installerPath);
res := Install_NETFramework();
case res of
1:
begin
Abort;
end
0:
begin
RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'MyAppKey');
end
-1:
begin
Abort;
end
end;
end else
begin
MsgBox('The application can not be installed unless the framework 3.5 be installed first.', mbError, MB_OK);
Abort;
end;
end else
begin
end;
end;
I think you still need to find a way to get the path to the executing installer if you want to install the key in the registry, but in addition, I think this code can help you with your question.
source
share