Verify ActiveX presence and registration

An ActiveX installation on PC can be verified by finding its ProgID from OleClass property in the registry.

This is sample code. Add error handling and adjust to your requirements as necessary.

? VerifyActiveX("MSWinsock.Winsock")
? VerifyActiveX("MSCAL.Calendar")
? VerifyActiveX("MSComCtl2.DTPicker")
 
RETURN 
&&-----------------------------------------
 
FUNCTION VerifyActiveX
LPARAMETERS tcProgID
#DEFINE HKEY_CLASSES_ROOT    -2147483648
 
LOCAL loReg, lcActiveXFileName, lcCLSID, llOK
loReg = NEWOBJECT("Registry", "registry.prg")
&& See if ProgID for ActiveX exists in the registry
lcCLSID = loReg.ReadRegistryString(HKEY_CLASSES_ROOT, tcProgID + "\CLSID" , "")
llOK = NOT ISNULL(lcCLSID)
IF llOK
	&& See if actual file implementing ActiveX is specified and exists
	lcActiveXFileName = loReg.ReadRegistryString(HKEY_CLASSES_ROOT, "CLSID\" + lcCLSID + "\InprocServer32" , "")
	llOK = NOT ISNULL(lcActiveXFileName) AND FILE(lcActiveXFileName)
ENDIF	
 
RETURN llOK

The registry class can be downloaded from http://berezniker.com/files/registry.zip