Mega Code Archive

 
Categories / Delphi / Activex OLE
 

To check if OLE object is installed

Title: to check if OLE object is installed Question: How can I check if OLE object is installed? Answer: Sometimes in development if you use OLE automation of some obejct, your application will not work because application is not installed on client computer. For example, you use MS excel automation but MS Excel is not installed. You can easy check if OLE object is installed and correctly registered using CLSIDFromProgID function (for MS Excel as example only): var ClassID: TCLSID; strOLEObject: string; begin strOLEObject := 'Excel.Application'; if (CLSIDFromProgID(PWideChar(WideString(strOLEObject)), ClassID) = S_OK) then begin end else begin end end; In same manner you can check any other required OLE object. With best regards, Mike Shkolnik EMail: mshkolnik@scalabium.com http://www.scalabium.com