VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Context Menu (Un)Register OCX and DLL

by Chin Huat (3 Submissions)
Category: Registry
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (15 Votes)


I'm still new to creating ActiveX DLL. After downloading some DLL plugin samples from vbcoders i found that some of the codes need to register the DLL manually (that is typing "c:\windows\system\regsvr32.exe DLLFILENAME" in MS-DOS prompt) or an extra EXE is created for that purpose. Why not add an "Register DLL" option into context menu (the menu which pops up when you right click on any dll files with your mouse on right panel of Windows Explorer)?

Rate Context Menu (Un)Register OCX and DLL





  1.  Click on Start Menu, choose "Run".
  2.  Type "regedit" and click "OK".
  3.  On the left panel of Registry Editor, go to : 


    My Computer\HKEY_CLASSES_ROOT\dllfile


    (expand the tree with alot of folder icons, from "My Computer", then "HKEY_CLASSES_ROOT" and then "dllfile", by clicking the "+" sign) 
  4.  Right click on "dllfile", choose "New" -> "Key".
  5.  Rename the new key to "shell". IT SHOULD BE AT THE SAME LEVEL AS THE "DefaultIcon" KEY! 

  6.  Create another key named "Register" under "shell"
  7.  On the right panel, set "(Default)" string value into "Register DLL" by double clicking on it.
  8.  Create another key named "command" under "Register"
  9.  Again, set the "(Default)" string value under "command" to: 


    C:\windows\system\regsvr32.exe "%1"


  10.  Restart your computer.
  11.  Now, right-click on some DLL files, there should be an extra option "Register DLL". Click on it.
  12.  A message box will appear, displaying the success message.

Just in case you want to add another option called "Unregister DLL", you can create another key named "Unregister" under "shell" ("Unregister" should be the same level as "Register") and set the "(default)" string value to "Unregister DLL". Under "Unregister", create another key called "command" and set the "(default)" string value to 


    C:\Windows\System\RegSvr32.Exe /u "%1" 


Restart your computer. "Unregister DLL" should be available in context menu. The same trick applies to all file types. Let me know if you still have any problem. 






Note:


  1. To make the same option available for .OCX files, search for "ocxfile" key under "HKEY_CLASSES_ROOT" and repeat step 4 to 12
  2. Let say if you want to add a shell option to a file with extension .ABC , you must find the ".ABC" key under "HKEY_CLASSES_ROOT". Memorize the default value under the key, (eg, "(Default)" is set to "ABCFile"). Find the key with the same same as the value (in this case, the key name is "ABCFile"). Now repeat from step 4 to 12. IF YOU CREATE THE "shell" key under ".ABC", THINGS WILL NOT WORK OUT!
  3. Backup your registry file so that you can restore them, just in case anything worse happen. Choose "Registry" from the menu, then "Export Registry File". The rest should be self explainable. 
  4. Windows ME (and 2000?) already have this built-in function. The "Open With" context menu option now contains "Microsoft(C) Register Server". Clicking on it will register the DLL only but not unregister it!



Download this snippet    Add to My Saved Code

Context Menu (Un)Register OCX and DLL Comments

No comments have been posted about Context Menu (Un)Register OCX and DLL. Why not be the first to post a comment about Context Menu (Un)Register OCX and DLL.

Post your comment

Subject:
Message:
0/1000 characters