Inno Setup安装前检测程序是否安装

来源:互联网 发布:java图片转base64 编辑:程序博客网 时间:2024/05/20 04:30

function InitializeSetup(): Boolean;//安装前事件
var
ResultCode: Integer;
begin
//检查.net2.0是否安装
if RegKeyExists(HKLM, 'SOFTWARE/Microsoft/.NETFramework/policy/v2.0') then
begin
//检查J#2.0环境是否安装
   if RegKeyExists(HKLM,'SOFTWARE/Classes/CLSID/{DC4709B6-4F1B-427E-BCBB-F48CA13DB8F5}/InprocServer32/2.0.0.0') then
    begin
    Result := true;
    end
    else
     begin
     ExtractTemporaryFile('J#2.0.exe');
     //MsgBox('没有安装J#2.0环境,Delphi2007运行将出错,请安装后再运行本安装程序!',mbInformation,MB_OK);
     Exec(ExpandConstant('{tmp}/J#2.0.exe'), '', '', SW_SHOW,ewWaitUntilTerminated, ResultCode);
     Result:=true;
     end;
end
else
begin
    MsgBox('Delphi2007需要.Net Framework2.0环境,请先安装后再运行本程序!',mbInformation,MB_OK);
    Result := false;
end;
end;

原创粉丝点击