hello guys,

just want to ask if you have a module for adding/deleting of registry key easily, I have tried reading some articles and they have given some of their examples.. but its not working... i'm working now on adding this registry key

HKEY_CLASSES_ROOT
Folder\shell\Use Zip Help\command
ValueName = (Default)
RegValue= "C:\Program Files\Zip Help\Zip Help.exe" "%1"

thanks

Recommended Answers

All 10 Replies

Adding it is a lot easier than deleting. Namely, because deleting usually requires that the key be empty, so that it can not contain any sub-keys or values. Adding The key/Value is pretty easy with scripting, like so:

dim wsh
set wsh = createobject("WScript.Shell")
wsh.regwrite "HKCR\Folder\shell\Use Zip Help\command", "C:\Program Files\Zip Help\Zip Help.exe " & chr(34) & "%1" & chr(34), "REG_SZ"

The deleting process however, will require you to enumerate the key you want to delete (for both sub-keys and values) delete all of those, and then delete the key in question. When I get home from work I'll post the code for enumeration and deleting.

thanks for the reply... I have tried your code and its a lot more simplier than the others I read, but I need to have a key equals to "(Default)" with key value = "C:\Program Files\Zip Help\Zip Help.exe" "%1", I tried to modify the code you given me but the result looks like this
[IMG]http://10.34.193.20:1410/key%20value.bmp[/IMG]
and two "(Default)" keys are created, thus the registry doesn't work at all

by the way, I'm adding this registry to add a right click menu option for my VB programs

thanks

oops, I forgot the slash after.... try this:

dim wsh
set wsh = createobject("WScript.Shell")
wsh.regwrite "HKCR\Folder\shell\Use Zip Help\command\", "C:\Program Files\Zip Help\Zip Help.exe " & chr(34) & "%1" & chr(34), "REG_SZ"

Great!! adding of new registry key from vb program is working now and a lot more easier....

Using this registry key will add a new menu(Use Zip Help) everytime we right click on a "Folder"... any idea how to get the location path of the folder clicked and pass it to the VB program... lets say we have a simple VB application consisting of a text box and a command button, the program works like this, any text enter in the text box will be shown every time we clicked on the command button.... now the registry we just add will just open the vb application without passing any information... any idea doing this?

thanks a lot

I wrote a program for people who need to quickly change the file extention of a program, on windows machines that have explorer hide the file extention. It adds a menu to any file that is right clicked, and gives you the option to select the program. Once the program is loaded, it automatically loads the filename of the program chosen. I'm guessing this is your plan, since I don't fully understand your question, but let me know if this helps.

Comatose,

I tried using the file you attached... maybe its just me.. but I still can't get the result I want.... I have attached a simple program, this program should show the text in the text box by msgbox upon clicking on the command button, from my previous post after add the registry value... it give us new option when we right click a "Folder" and allowing us to call the program easily, now for my follow up question can we pass the location of the right clicked "Folder" and directly pass it to the checkbox so we don't need to type the location in the text box, so we simply click on the command button showing us the location of the Folder

thanks a lot

The only thing I see is a button that msgbox's the text in the textbox. Help me out here, I need a layout of exactly what needs to happen. What should the right-click menu say? What should happen when it's selected? Does it need to know the filename that was clicked on? If so, why?

the attached file is just an example, though the idea is still the same
1. using the attached file (help.zip) we will add a right click menu using the registry, so if the created exe file is named "Project1.exe" then when the project is loaded it will create a registry key something like this..
>>> "HKCR\Folder\shell\Use Project1\command\", "C:\Program Files\Zip Help\Project1.exe " & chr(34) & "%1" & chr(34), "REG_SZ"
*** this part was already solve
2. For the second question, is there a way that when we right click a folder, and click "Use Project1" from the right click menu it will then pass the folder location to the textbox within Project1.exe, so that when we use the rigth click, we don't have to enter it in the text box

3. "What should the right-click menu say? What should happen when it's selected? Does it need to know the filename that was clicked on? If so, why? "
>>> refencing from the attached file the right-click menu say "Use Project1", when it selected Project1.exe will be activated, and it should know the location of the folder selected, doing this will help the user not to browse the folder and get its location easily

hope I have make my point clear =)

thanks

Adding it is a lot easier than deleting. Namely, because deleting usually requires that the key be empty, so that it can not contain any sub-keys or values. Adding The key/Value is pretty easy with scripting, like so:

dim wsh
set wsh = createobject("WScript.Shell")
wsh.regwrite "HKCR\Folder\shell\Use Zip Help\command", "C:\Program Files\Zip Help\Zip Help.exe " & chr(34) & "%1" & chr(34), "REG_SZ"

The deleting process however, will require you to enumerate the key you want to delete (for both sub-keys and values) delete all of those, and then delete the key in question. When I get home from work I'll post the code for enumeration and deleting.

HI I CREATED THE REG KEY FROM THE ABOVE CODE NOW I WANT TO GET THE PATH ADDRESS OF THE FOLDER WERE I RIGHT CLICKED .PLEASE REPLY THANKS IN ADVANCE

commented: SO HOW ABOUT YOU FIGURE IT OUT AND POST A NEW THREAD -2
commented: 3 years late with the hijack, and YELLING LIKE A MORON -6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.