» Help

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;
  WPID: WideString;  // PID as wide string
  Dummy: TGUID;      // unused out value from CLSIDFromProgID function
  WPID := PID;
  Result := ActiveX.Succeeded(
    ActiveX.CLSIDFromProgID(PWideChar(WPID), Dummy)

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;
  Result := ProgIDInstalled('InternetExplorer.Application');

Both the above routines are available from the Code Snippets Database.

The following program IDs for MS applications may be useful:

  • Access.Application
  • Excel.Application
  • FrontPage.Application
  • Outlook.Application
  • PowerPoint.Application
  • MSProject.Application
  • Word.Application

This tip was created by DelphiDabbler from code contributed by Michael Rockett.

Author: Peter Johnson
Contributor: Michael Rockett
Added: 2014-01-23
Last updated: 2014-01-23

« Return to contents »