ActiveX Shell Registration

ActiveX Shell Registration

Author: Emmanuel KARTMANN <emmanuel@kartmann.org>.

Date: December 15, 1999

Sample Image

Environment: Windows NT4 SP4, Windows 95/98

For those among us who develop ActiveX/COM objects, here's a little trick to help you with registering/unregistering your components easily. With a simple modification to the registry, you will have additional register/unregister menu options (accessible with the right-mouse button) integrated in your Windows Shell, as shown in the above screen shot.

You can also register a component by double-clicking on it!

Note that if you're paranoid with .reg files (like me ;-), you can manually create the register/unregister menu for your components (see section "Manual Installation" below).

I also shipped in the kit a new version of regsvr32.exe (called regsvr33...) which print a clear-text error message if registration fails (instead of an error code).

Automatic Installation

To install the additional menu options in your shell:

bulletOpen a Windows Explorer
bulletBrowse to the directory where the .reg files are located:
DLL_Register_Unregister.reg
OCX_Register_Unregister.reg
bulletDouble-click on file DLL_Register_Unregister.reg
bulletA dialog box pops-up, saying:
"Information in DLL_Register_Unregister.reg has been successfully entered into the registry."
bulletClick on the "OK" button"
bulletDouble-click on file OCX_Register_Unregister.reg
bulletA dialog box pops-up, saying:
"Information in OCX_Register_Unregister.reg has been successfully entered into the registry."
bulletClick on the "OK" button"

The program regsvr32.exe must be in your PATH. Put the program (if you don't already have it, it's in .zip file for this article) in your system directory (e.g. "C:\winnt\system32" on Windows NT).

Manual Installation

To install the additional menu options in your shell:

bulletStart a Windows Explorer
bulletSelect menu option "View" / "Options..."
bulletClick on tab "File Types"
bulletClick on button "New Type..."
bulletType description of type: ActiveX COMponent
bulletType Content Type (MIME): application/ocx
bulletType Default Extension for Content Type: .OCX
bulletClick on checkbox "Enable Quick View"
bulletClick on button "New..." below (Action)
bulletType Action name: Register
bulletType Application used to perform action: regsvr32.exe "%1"
bulletCAUTION: do not forget the double-quotes before and after %1
bulletClick on button OK
bulletSelect action "Register", click on button "Set Default"
bulletClick on button "New..." below (Action)
bulletType Action name: Unregister
bulletType Application used to perform action: regsvr32.exe /u "%1"
bulletCAUTION: do not forget the double-quotes before and after %1
bulletClick on OK
bulletClick on button "Change Icon..."
bulletPick up an cool icon in shell32.dll, like:

bulletClick on OK

Note that there is a difference with automatic registration: you can't add the menu option for DLLs (there's no associated file type in the Windows Explorer...). Only automatic registration can do that.

Usage

Registering a COMponent

bulletStart a Windows Explorer
bulletBrowse to the directory containing your component
bulletDouble-click on your component
OR
Select the OCX or DLL file, click on right mouse button, select option "Register COMponent"

bulletA dialog box pops-up, saying that registration is successfull:

Unregistering a COMponent

bulletStart a Windows Explorer
bulletBrowse to the directory containing your component
bulletSelect the OCX or DLL file, click on right mouse button, select option "Unregister COMponent"

bulletA dialog box pops-up, saying that unregistration is successfull.

Download

Download Article and Source Code (14 KB).