首先,爲應用程序創建一個新的GUID(這就像在註冊表中爲您的應用程序中的主鍵)
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
#define MyAppGUID "D8C85F98-A805-4237-8D7C-C2F050C19B47"
#define MyAppId MyAppName + "_" + MyAppGUID
在節[編號]和功能InitializeSetup添加該指令()。
[Code]
function InitializeSetup(): Boolean;
var
ResultCode: Integer;
ResultStr:string;
begin
// Check if the application is already install
// MsgBox('MyAppId = ' + '{#MyAppId}', mbInformation, mb_Ok);
begin
If RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1', 'UninstallString', ResultStr) then begin
If ResultStr<>'' then begin
ResultStr:=RemoveQuotes(ResultStr);
if MsgBox('This application is already install. ' #13#13 'Uninstall it ?', mbConfirmation, MB_YESNO) = idYes then
if not Exec(ResultStr, '/silent', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
MsgBox('Erreur !!! ' #13#13 '' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
end;
end;
end ;
Result := True;
end;
您應該從該章的'DisplayVersion'中比較[Display version](http://stackoverflow.com/a/22356942/960757)值。鍵(請注意,可以安裝64位播放器,因此您應該在兩個視圖中檢查它們)與要安裝的內容。如果該版本較低,請運行「UninstallString」鍵值(或執行['uninstaller from here'](http://www.adobe.com/shockwave/download/alternates/#sp))中存儲的內容。 – TLama 2014-11-24 15:07:09