Installing and Registering ActiveX Controls

ActiveX controls are in-process COM servers that are packaged as dynamic link libraries (DLLs) with an .ocx file name extension. To make their services available to applications, they must be registered with Windows. By convention, each ActiveX control's DLL file contains a special entry point DllRegisterServer that performs this registration upon request. A second entry point, called DllUnregisterServer, is used to roll back the registration when the ActiveX control is removed from the system.

InstallMate's Setup program knows how to register and unregister ActiveX controls. All necessary functionality is built into Setup.exe; no external helper programs such as regsvr32.exe are required. All that you need to do is add the ActiveX control's DLL file to your InstallMate project. InstallMate automatically recognizes ActiveX controls and will mark them for registration as required.

ActiveX controls are typically installed as shared files in the Windows System folder. Within InstallMate, this folder is available as Windows\System (32-bit) on the Files and folders project page. Unless you know what you are doing and have a very good reason to do otherwise, we recommend that you follow this convention.

How to add an ActiveX control to your project

To add an ActiveX control to your InstallMate project, act as follows.

  1. Select the Files and folders project page in the navigation panel on the left.
  2. On the Files and folders project page, click on the Windows\System (32-bit) folder.

  3. Add the ActiveX control's DLL file as an installation file to the Windows\System (32-bit) folder. If necessary, refer to the Installing Files topic for information about adding installation files to folders.
  4. Select the newly added ActiveX control file to display its attributes in the File attributes pane, then check that the following options are set:

    • Install action - Install if newer
    • Remove action - Remove if installed
    • Registration - Use DllRegisterServer
    • Shared file - checked

    If you followed the procedure above, InstallMate will have set these options for you and you don't have to change anything.

  5. If the ActiveX control uses a separate license key file, simply install that file along with the ActiveX DLL file. Be sure to assign both files to the same component, so they will be installed and removed together
  6. If the ActiveX control uses license key information in the registry and you have the required .reg file with the registry information, do the following.
    1. Go to the Registry project page.
    2. Right-click on the Registry tree node and select Import RegEdit File from the popup menu.
    3. Browse to the required .reg file for the ActiveX control and select it. In the Bulk Import dialog box that appears, select Assign to existing component and select the same component as the ActiveX DLL file.
  7. Repeat steps 3-6 as required for other ActiveX controls.

The net result is that the ActiveX controls will be installed and registered when their component or your product as a whole is installed, and unregistered and removed when their component or your product as a whole is uninstalled. All this is subject to the usual rules for file installation; in particular, InstallMate will correctly handle updates of existing copies of an ActiveX control (based on a version check) and will only remove and unregister the control if no other applications use it. This remains true even if the SharedDlls reference count of an ActiveX control is unreliable (as is often the case with third-party controls).