后端开发
inno setup制作的软件包安装前判断是否安装.NET FRAMEWORK4.0
发布时间:2024-04-01 22:58:53 浏览量:157
[Code]
function CheckDotNet4_0():boolean;
begin
if RegKeyExists(HKLM, 'SOFTWAREMicrosoft.NETFrameworkpolicyv4.0') and RegKeyExists(HKLM, 'SOFTWAREMicrosoftNET Framework SetupNDPv4Full') then //通过判断注册表看是否安装.NET4.0
begin
Result:= False; //存在就返回不需要安装的结果
end
else
begin
Result:= True; //不存在就返回需要安装的结果
end;
end;
procedure CurStepChanged(curstep:TSetupStep);
var ResultCode: Integer;
begin
if CurStep=ssinstall then //inno setup运行前执行
begin
if CheckDotNet4_0() then //判断系统注册表电脑有没有安装.NET4.0后如果为TRUE就先安装.NET4.0
begin
ExtractTemporaryFile('dotNetFx40.exe');
Exec(ExpandConstant('{tmp}dotNetFx40.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
if CurStep=ssDone then //inno setup运行完成后执行
begin
MsgBox('集成包软件已运行完',mbinformation,MB_OK);
end;
end;