簡體   English   中英

Inno設置:根據產品代碼檢測安裝

[英]Inno setup: detect installation based on product code

我希望實現與Inno設置類似的功能- 如果未安裝其他程序,請跳過安裝

但我確實有msiexec產品代碼(如D3AA40C4-9BFB-4640-88CE-EDC93A3703CC)。 那么如何根據此產品代碼檢測是否安裝了其他程序?

這有MsiQueryProductState函數。 以下是為您的任務導入的輔助函數:

[Code]
#IFDEF UNICODE
  #DEFINE AW "W"
#ELSE
  #DEFINE AW "A"
#ENDIF
type
  INSTALLSTATE = Longint;
const
  INSTALLSTATE_DEFAULT = 5;

function MsiQueryProductState(szProduct: string): INSTALLSTATE; 
  external 'MsiQueryProductState{#AW}@msi.dll stdcall';

function IsProductInstalled(const ProductID: string): Boolean;
begin
  Result := MsiQueryProductState(ProductID) = INSTALLSTATE_DEFAULT;
end;

它的可能用途:

if IsProductInstalled('{D3AA40C4-9BFB-4640-88CE-EDC93A3703CC}') then
  MsgBox('The product is installed.', mbInformation, MB_OK);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM