Author: David Johannes Rieger
How can I check if Microsoft Word is installed?
Answer:
Solve 1:
Important: this method will only succeed if Microsoft Word 95 or higher is
installed.
1 uses2 ..., Registry;
3 4 function IsMicrosoftWordInstalled: Boolean;
5 var6 Reg: TRegistry;
7 S: string;
8 begin9 Reg := TRegistry.Create;
10 with Reg do11 begin12 RootKey := HKEY_CLASSES_ROOT;
13 Result := KeyExists('Word.Application');
14 Free;
15 end;
16 end;
Solve 2:
17 function MSWordIsInstalled: Boolean;
18 begin19 Result := AppIsInstalled('Word.Application');
20 end;
21 22 function AppIsInstalled(strOLEObject: string): Boolean;
23 var24 ClassID: TCLSID;
25 begin26 Result := (CLSIDFromProgID(PWideChar(WideString(strOLEObject)), ClassID) = S_OK)
27 end;