How to check if a program is installed using its program identifier
The following code will return True if a program with the given program ID is installed and registered with the system or False if the program ID is not known.
function ProgIDInstalled(const PID: string): Boolean; var WPID: WideString; // PID as wide string Dummy: TGUID; // unused out value from CLSIDFromProgID function begin WPID := PID; Result := ActiveX.Succeeded( ActiveX.CLSIDFromProgID(PWideChar(WPID), Dummy) ); end;
To find if a program that registers a program ID is installed, just pass the ID to this routine. For example, the following routine checks if Internet Explorer installed:
function IsIEInstalled: Boolean; begin Result := ProgIDInstalled('InternetExplorer.Application'); end;
Both the above routines are available from the DelphiDabbler Code Snippets Database.
The following program IDs for MS applications may be useful:
This tip was created by DelphiDabbler from code contributed by Michael Rockett.