一硫痰、檢測.net以及VC++
[Files]
; VC Redistribute
Source: ".\安裝包\vcredist2010x86.exe"; DestDir: "{tmp}"; Check: NeedInstallVC10
Source: ".\安裝包\vcredist2013x86.exe"; DestDir: "{tmp}"; Check: NeedInstallVC13
; .net Framework
Source: ".\安裝包\NDP452-x86-x64ENU.exe"; DestDir: "{tmp}"; Flags: ignoreversion {#IsExternal}; Check: NeedsFramework
[Run]
Filename: {tmp}\NDP452-x86-x64ENU.exe; Parameters: "/q:a /c:""install /l /quiet"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installing .NET Framework if needed"
Filename: {tmp}\vcredist2010x86.exe; Parameters: "/q:a /c:""install /l /quiet"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Install Microsoft Visual C++ 2010 Runtime ...";
Filename: {tmp}\vcredist2013x86.exe; Parameters: "/q:a /c:""install /l /quiet"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Install Microsoft Visual C++ 2013 Runtime ...";
[code]
//檢測VC++
var
vc10SP1Missing: Boolean;?
vc13SP1Missing: Boolean;
function NeedInstallVC10(): Boolean;?
begin
? ? ? Result :=? vc10SP1Missing;
end;
function NeedInstallVC13(): Boolean;?
? begin
????Result :=? vc13SP1Missing;
? end;
// 是否有.net4.0環(huán)境
function IsDotNET40Detected(): boolean;
var
? ? success: boolean;
begin
?success := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\Policy\v4.0');
? ? Result :=? success;
end;
function NeedsFramework(): Boolean;
begin
? Result := (IsDotNET40Detected = false );
end;
在函數(shù)?InitializeSetup()里給vc13SP1Missing與vc10SP1Missing賦值
? ?//檢測VC++2013
? ?if RegValueExists(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\12.0\VC\Runtimes\x86', 'Version') then
? ? ? begin
? ? ? ? vc13SP1Missing := false;
? ? ? end
? ? else
? ? ? begin
? ? ? ?vc13SP1Missing := true;
? ? ? end;
//檢測VC++2010
? if RegValueExists(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86', 'Version') then
? ? ? begin
? ? ? ? vc10SP1Missing := false;
? ? ? end
? ? else
? ? ? begin
? ? ? ? vc10SP1Missing := true;
? ? ? end;
ok完成。
二惑芭、MsgBox的三按鈕選擇
case MsgBox('安裝程序檢測到 {#MyAppName} 已安裝酷窥!'#13''#13'單擊“是”按鈕保留數(shù)據(jù)繼續(xù)安裝;'#13''#13'單擊“否”按鈕卸載耕捞;'#13''#13'單擊“取消”按鈕退出安裝衔掸!', mbConfirmation, MB_YESNOCANCEL) of
?IDYES:
? ? begin?
? ? ? ? Result:= true;
? ? end;
?IDNO:
? ? begin
? ? ? ?AppExisPathUn := RemoveQuotes(AppExisPathUn);?
? ? ? ?Exec(AppExisPathUn, '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);? ?
? ? ? ?Result:= false;?
? ? end;
?IDCANCEL:
? ? begin
? ? ? Result:= false;
? ? end;?
end;
三,文檔?點擊進入