Skip to main content

[Migrated content. Thread originally posted on 17 December 2003]

In my program I want to check if an ActiveX control is registered on the local workstation. Is there anyway of doing this?

This will allow me to do a pre-check of registered AcitveX controls to make sure that my application will function correctly, minimising runtime errors like "Class not Registered".

Help!

[Migrated content. Thread originally posted on 17 December 2003]

In my program I want to check if an ActiveX control is registered on the local workstation. Is there anyway of doing this?

This will allow me to do a pre-check of registered AcitveX controls to make sure that my application will function correctly, minimising runtime errors like "Class not Registered".

Help!
The simplest approach is to include object exception handling in your declaratives section. This is pretty straight forward, test for the condition and if you like, provide dynamic installation on the fly.

An exception handler in the declaratives section is at any rate a must if you ask me.

However, if you would be able to control whether the control is installed before you actually try to invoke it. Use the CLSID provided in the CLASS segment of the def file, look up the registry at:
HKEY_CLASSES_ROOT\\CLSID\\{CLSID here}

If this key exists, your control should be registered, however, to be double sure, you can also check if the file specified in:

HKEY_CLASSES_ROOT\\CLSID\\{CLSID here}\\InprocServer32

exists. This registry hive also have a version branch, in which the current version info is provided.