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:
Open a Windows Explorer
Browse to the directory where the .reg files are located:
DLL_Register_Unregister.reg
OCX_Register_Unregister.reg
Double-click on file DLL_Register_Unregister.reg
A dialog box pops-up, saying:
"Information in DLL_Register_Unregister.reg has been successfully entered into the registry."
Click on the "OK" button"
Double-click on file OCX_Register_Unregister.reg
A dialog box pops-up, saying:
"Information in OCX_Register_Unregister.reg has been successfully entered into the registry."
Click 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).
To install the additional menu options in your shell:
Start a Windows Explorer
Select menu option "View" / "Options..."
Click on tab "File Types"
Click on button "New Type..."
Type description of type: ActiveX COMponent
Type Content Type (MIME): application/ocx
Type Default Extension for Content Type: .OCX
Click on checkbox "Enable Quick View"
Click on button "New..." below (Action)
Type Action name: Register
Type Application used to perform action: regsvr32.exe "%1"
CAUTION: do not forget the double-quotes before and after %1
Click on button OK
Select action "Register", click on button "Set Default"
Click on button "New..." below (Action)
Type Action name: Unregister
Type Application used to perform action: regsvr32.exe /u "%1"
CAUTION: do not forget the double-quotes before and after %1
Click on OK
Click on button "Change Icon..."
Pick up an cool icon in shell32.dll, like:
Click 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
Start a Windows Explorer
Browse to the directory containing your component
Double-click on your component OR
Select the OCX or DLL file, click on right mouse button, select option "Register COMponent"
A dialog box pops-up, saying that registration is successfull:
Unregistering a COMponent
Start a Windows Explorer
Browse to the directory containing your component
Select the OCX or DLL file, click on right mouse button, select option "Unregister COMponent"
A dialog box pops-up, saying that unregistration is successfull.
Add www.codeguru.com to your favorites Add www.codeguru.com to your browser search box IE 7 | Firefox 2.0 | Firefox 1.5.xReceive news via our XML/RSS feed
RATE THIS ARTICLE:
Excellent Very Good Average Below Average Poor
(You must be signed in to rank an article. Not a member? Click here to register)