There is the MsiQueryProductState
function for this. Here is its import with a helper function for your task:
[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;
And its possible usage:
if IsProductInstalled('{D3AA40C4-9BFB-4640-88CE-EDC93A3703CC}') then
MsgBox('The product is installed.', mbInformation, MB_OK);