Verify ActiveX presence and registration

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

$SAMPLECODE$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

? 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

Comments