Im trying to install ndp48-x86-x64-allos-enu.exe
on computers that don't have it.
I have both those procedures :
the check function:
function NETFrameworkIsNotInstalled: Boolean;
var
ver: Cardinal;
begin
Result :=
not
(
(RegKeyExists(
HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client')
and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', 'Release', ver)
)
or
(RegKeyExists(
HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full')
and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', ver)
)
)
or (ver < 528040)
end;
and the installer procedure :
procedure InstallNETFramework;
var
ResultCode: Integer;
StatusText: string;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing .NET Framework 4.8...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
// i tried with and without "ExtractTemporayFile() and also tried ShellExec() and Exec(), none work
ExtractTemporaryFile('ndp48-x86-x64-allos-enu.exe');
if not ShellExec('open',ExpandConstant('{app}\ndp48-x86-x64-allos-enu.exe'), '/q /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
then
begin
MsgBox('.NET Framework 4.8 Installation did not succeed : ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
the checking procedure works perfectly and so the installer procedure runs BUT nothing shows up, eventualy, the step just passes to the next one and it doesn't get installed.
Here are more informations :
[Files]
Source: "Dependencies\ndp48-x86-x64-allos-enu.exe"; DestDir: "{app}"; Flags: deleteafterinstall; AfterInstall: InstallNETFramework; Components: NETFrameworkComponent; Check: NETFrameworkIsNotInstalled
[Code]
var CancelWithoutPrompt: boolean;
function InitializeSetup(): Boolean;
begin
CancelWithoutPrompt := false;
result := true;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID=wpInstalling then
Confirm := not CancelWithoutPrompt;
end;
Attempts: so far, I've tried the ShellExec() and Exec() function, i though it would be an administrator privilege at first but I have all the right on the device I'm trying to install it on, also, it is not a exe probleme because I tried running it directly with my mouse and it worked perfectly. a window with the quote and a progress bar: Extracting file
should appear.