function MsiEnumProducts(iComponentIndex: Integer; lpComponentBuf: String): Integer; external 'MsiEnumProductsA@MSI.DLL stdcall';
function IsProductInstalled(szCheckedProduct: String): Boolean;
var
index: integer;
szProduct: String;
begin
Result := False;
index := 0;
szProduct := '{00000000-0000-0000-0000-000000000000}';
while True do
begin
if 0 <> MsiEnumProducts(index,szProduct) then
break;
if szProduct = szCheckedProduct then
Result := True;
index := index + 1;
end;
end;
function IsOfficeInstalled(): Boolean;
var
Office,Excel: string;
Office2k,OfficeXP,Office2k3: Boolean;
begin
//Office 2k
Office := '{00000409-78E1-11D2-B60F-006097C998E7}';
Office2k := IsProductInstalled(Office);
//Office XP
Office := '{20280409-6000-11D3-8CFE-0050048383C9}';
OfficeXP := IsProductInstalled(Office);
//Office XP + FrontPage
Office := '{90280409-6000-11D3-8CFE-0050048383C9}';
OfficeXP := OfficeXP OR IsProductInstalled(Office);
//Office 2k3 Prof
Office := '{90110409-6000-11D3-8CFE-0150048383C9}';
Office2k3 := IsProductInstalled(Office);
//Office 2k3 Std
Office := '{91120409-6000-11D3-8CFE-0150048383C9}';
Office2k3 := Office2k3 OR IsProductInstalled(Office);
Result := Office2k OR OfficeXP OR Office2k3;
end;