by Jim Karabatsos - GUI Computing
Adding Register and UnRegister to the Explorer Context Menus
I dunno why I didn't think of this one myself.
Do you find it a pain to run REGSVR32 to register and unregister OCXs and ActiveX DLLs? Well, with a simple registry hack, you can add two new items on the context menu that pops up in Explorer when you right-click on one of these files.
Here is the .reg file that you need to set up the keys:
REGEDIT4 [HKEY_CLASSES_ROOT\.dll] "Content Type"="application/x-msdownload" @="dllfile" [HKEY_CLASSES_ROOT\dllfile] @="Application Extension" [HKEY_CLASSES_ROOT\dllfile\Shell\Register\command] @="regsvr32.exe \"%1\"" [HKEY_CLASSES_ROOT\dllfile\Shell\UnRegister\command] @="regsvr32.exe /u \"%1\"" [HKEY_CLASSES_ROOT\.ocx] @="ocxfile" [HKEY_CLASSES_ROOT\ocxfile] @="OCX" [HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command] @="regsvr32.exe \"%1\"" [HKEY_CLASSES_ROOT\ocxfile\Shell\UnRegister\command] @="regsvr32.exe /u \"%1\""
As you can see, it creates two commands each for both DLL and OCX files. It is a cute trick -- usually, these commands run the program and pass it a command line switch to make it do something other than open interactively.
For example, if you point to a text file (a file with a .TXT extension) and right click, you will see a "Print" menu item. If you look in the registry under HKCR\txtfile\shell\print\command you will see a default string item with the value "%SystemRoot%\system32\NOTEPAD.EXE /p %1" (at least in NT -- it is a little different in Win9x).
The /p tells Notepad to print the file. Try it: at a command prompt, type:
NOTEPAD /P C:\AUTOEXEC.BATYou should see Notepad appear with the file loaded, the "Printing" dialog displayed, then Notepad should close itself down. This is because Notepad is looking for switches on the command line.
What this neat little hack does is to create "Register" and "Unregister" commands for OCX and DLL file types that run RegSvr32 with the appropriate switch and the filename.
Very, very clever. Credit for this idea goes to Jon Evans (email@example.com).