Inno Setup安裝前檢測程序是否安裝

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;

發佈了31 篇原創文章 · 獲贊 3 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章