ActiveX Shell Registration

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:
- 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).
Manual Installation
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
- 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:

- 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.

Comments
Registering Components
Posted by Legacy on 09/29/2003 12:00amOriginally posted by: James Ball
Adding the following entries to the registry will allow registration of components by right clicking the component and selecting register or un-register with regsvr32 from the pop up menu. To add the registry entries create a text file by copying and pasting the following text into notepad, then save the file with a .reg extension, place the .reg file on your C drive and double click it's icon. Don't forget you will need to have regsvr32 on your system.
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Register with RegSvr32]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Register with RegSvr32\Command]
@="regsvr32 \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Unregister with RegSvr32]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Unregister with RegSvr32\Command]
@="regsvr32 -U \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ocx]
@="ocxfile"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile]
@="ActiveX Custom Control"
"EditFlags"=hex:00,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\DefaultIcon]
@="%SystemRoot%\system32\shell32.dll,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\shell\Register with RegSvr32]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\shell\Register with RegSvr32\Command]
@="regsvr32 \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\shell\Unregister with RegSvr32]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ocxfile\shell\Unregister with RegSvr32\Command]
@="regsvr32 -U \"%1\""
[HKEY_CLASSES_ROOT\VisualBasic.Project\shell\Edit with Notepad]
[HKEY_CLASSES_ROOT\VisualBasic.Project\shell\Edit with Notepad\command]
Reply@="\"Notepad.exe\" \"%1\""
HELP!!!!!!!!!!!!!!
Posted by Legacy on 08/13/2003 12:00amOriginally posted by: Aza
ReplyActiveX Shell Registration for Windows 2000 Pro
Posted by Legacy on 04/16/2003 12:00amOriginally posted by: Hatem Elhannachi
Thanks for this tool;
Can I use this "tool" for WINDOWS 2000 PRO?
Replyhttp://www.saudistudents-nottingham.com
Posted by Legacy on 03/22/2003 12:00amOriginally posted by: Saudi students in nottingham
Established in March 2003
Replyhttp://www.geocities.com/rajabmah/
Posted by Legacy on 09/30/2002 12:00amOriginally posted by: Maher I. Rajab
Thanks for the tip. I've been looking for something like this ...
Maher
ReplyExplain ActiveX Dcoument, ActiveX EXE & AcitveX DLL ?
Posted by Legacy on 09/19/2002 12:00amOriginally posted by: kinnal
Replywhat about online registration and licensing?
Posted by Legacy on 06/14/2002 12:00amOriginally posted by: S.L.Narayanan
thanks man...u have mentioned only about registering the .ocx and .dll files in my system...but when it is embedded in a webpage and uploaded to a http server i cannot see it in the client systems...so can u help me and tell how to register and get the license for the activex control so that it can be used by any one...
ReplyGreat for DLL, what about EXE Component
Posted by Legacy on 05/25/2002 12:00amOriginally posted by: ano
Hi, I want to register my component which is EXE file.
Replycan you pls tell me what to do
What is the difference between a Component and ActiveX control??
Posted by Legacy on 04/10/2002 12:00amOriginally posted by: Santosh
ReplyPlease Help me~~~~~~ about dcom98.exe
Posted by Legacy on 11/08/2001 12:00amOriginally posted by: hwa min son
I have some questions.
Please, Help me.
Question 1)
How can I excute Dcom98.exe in the cab file that includes my program?
My computer's OS is Window98.
Question 2)
When I tried to Setup my activex controls, I got error message.
then I must setup dcom98.exe.
I wish to include dcom98 in my program.
but I don't know to way.
How can my setup program include dcom98.exe or have some special dll list?
Please~~~~~~~~~~~~~~~~~~~~~~~
ReplyLoading, Please Wait ...