ActiveX Shell Registration

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:

  • 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

    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.

Downloads

Download source - 14 Kb


Comments

  • Registering Components

    Posted by Legacy on 09/29/2003 12:00am

    Originally 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]
    @="\"Notepad.exe\" \"%1\""

    Reply
  • HELP!!!!!!!!!!!!!!

    Posted by Legacy on 08/13/2003 12:00am

    Originally posted by: Aza

    I registered Morrowind and Tribunal to my boyfriends computer. It is a hp pavilion XT 868. I just bought a computer from my friend. Since my bf's computer can't run my game, I want to play it on mine. I have to unregister it though and I don't know how. I don't know much about computers and neither does anyone else here. I can't find the things that you talk about on your page. Please help me!!!!!!!!!!   -Aza
    

    Reply
  • ActiveX Shell Registration for Windows 2000 Pro

    Posted by Legacy on 04/16/2003 12:00am

    Originally posted by: Hatem Elhannachi

    Thanks for this tool;
    Can I use this "tool" for WINDOWS 2000 PRO?

    Reply
  • http://www.saudistudents-nottingham.com

    Posted by Legacy on 03/22/2003 12:00am

    Originally posted by: Saudi students in nottingham

    Established in March 2003

    Reply
  • http://www.geocities.com/rajabmah/

    Posted by Legacy on 09/30/2002 12:00am

    Originally posted by: Maher I. Rajab

    Thanks for the tip. I've been looking for something like this ...

    Maher

    Reply
  • Explain ActiveX Dcoument, ActiveX EXE & AcitveX DLL ?

    Posted by Legacy on 09/19/2002 12:00am

    Originally posted by: kinnal

    Please explain fundametntals of AcitveX Document, ActiveX Document EXE and ActiveX Document DLL.
    

    Reply
  • what about online registration and licensing?

    Posted by Legacy on 06/14/2002 12:00am

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

    Reply
  • Great for DLL, what about EXE Component

    Posted by Legacy on 05/25/2002 12:00am

    Originally posted by: ano

    Hi, I want to register my component which is EXE file.
    can you pls tell me what to do

    Reply
  • What is the difference between a Component and ActiveX control??

    Posted by Legacy on 04/10/2002 12:00am

    Originally posted by: Santosh

    I studied in MSDN library about how to create ActiveX controls and how they are useful...
    
    

    I also studied about Components.

    But, I want to know the main difference between a Component and Control. In way how they are used and how they should be created..

    If anybody can clarify pl. welcome....

    Regards,
    Santosh.

    Reply
  • Please Help me~~~~~~ about dcom98.exe

    Posted by Legacy on 11/08/2001 12:00am

    Originally 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~~~~~~~~~~~~~~~~~~~~~~~


    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

  • Ever-increasing workloads and the challenge of containing costs leave companies conflicted by the need for increased processing capacity while limiting physical expansion. Migration to HP's new generation of increased-density rack-and-blade servers can address growing demands for compute capacity while reducing costly sprawl. Sponsored by: HP and Intel® Xeon® processors Intel, the Intel logo, and Xeon Inside are trademarks of Intel Corporation in the U.S. and/or other countries. HP is the sponsor …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds