Friday, April 24, 2009

Windows Registry Keys For Adding Register Dll/OCX Shortcut

Anyone that has ever had to deal with registering dlls knows that it is just plan annoying to have to type "regsvr32.exe" every single time you want to register a dll.  I'm a lazy programmer.  If I have to do something twice, that's once too many.  So I don't have to look all over the internet for the correct registery settings to perform this change, I'm posting it here on my blog.

Paste this text into a new text document, save it with a .reg extension, double click it, and select that "Yes" you "are sure you want to add the information in to the registry".  Done.


[HKEY_CLASSES_ROOT\dllfile\Shell]
@="Register"

[HKEY_CLASSES_ROOT\dllfile\Shell\Register]

[HKEY_CLASSES_ROOT\dllfile\Shell\Register\command]
@="regsvr32.exe \"%1\""

[HKEY_CLASSES_ROOT\dllfile\Shell\Unregister]

[HKEY_CLASSES_ROOT\dllfile\Shell\Unregister\command]
@="regsvr32.exe /u \"%1\""

[HKEY_CLASSES_ROOT\.ocx]
@="ocxfile"

[HKEY_CLASSES_ROOT\ocxfile]
@="OCX File"
"EditFlags"=hex:00,00,01,00

[HKEY_CLASSES_ROOT\ocxfile\Shell]
@="Register"

[HKEY_CLASSES_ROOT\ocxfile\Shell\Register]

[HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command]
@="regsvr32.exe \"%1\""

[HKEY_CLASSES_ROOT\ocxfile\Shell\Unregister]

[HKEY_CLASSES_ROOT\ocxfile\Shell\Unregister\command]
@="regsvr32.exe /u \"%1\""