Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
When I downloaded your program I can enumarte all registry keys but no values. When I look at the source code I can see the extra buttons such as delete values but can not see them when I run the program. When looking at the source they do not have any code attached to them either.
I noticed it worked for another user. Maybe it is just me.
Now, this is an example, but beware: it will delete keys and values, if you press the buttons...
To use it:
You have to choose a registry Root from Combo.
Then you should provide a registry key or press the "Enum Subkeys" button - in this second case, you can then select one from listbox, press Ctrl+C and paste in the registry Key textbox.
If you need to go deeper, you can now press the enum subkeys once more, and then repeat the above, adding the last key to the previous one with a "\" (ie: combo value: Hkey_current_user;
key txt value: AppEvents\EventLabels)
Once you are on the desired key you could delete it. Or you could press the Enum Values button to see
Value(=identifier)Name and Value Data.
Inserting the value name in the Value Txt will allow you to delete
that value - This will delete BOTH the value NAme and the value Data. To "Blank" only the value data, you should not delete, but simply change its value...
Last edited by Cimperiali; November 22nd, 2003 at 05:17 AM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Not sure what you are trying to accomplish but the easiest way to store and retrieve data to and from the registry is to use SaveSetting and GetSetting
SaveSetting appname, section, key, setting
GetSetting(appname, section, key[, default])
All goes to
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Your application
Just provide a name, a section and the key name and value
hth
Cheers,
Laurent
For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.
If you are curious, there is another method. WshShell object have the following method RegRead, RegWrite and RegDelete. It prevents you from using a tons of API, but at the same time, you'll need to add the reference to Windows Script Host Model, anyway, here is a small example, it is the equivalent of the module using API:
Code:
Private Sub Command1_Click()
'Add a reference to Windows Script Host Model
Dim objReg As New WshShell
Dim strKey As String
'This key will be created by SaveSetting in a second
strKey = "HKEY_USERS\.DEFAULT\Software\VB and VBA Program Settings\REGTEST\TESTSECTION\TESTKEY"
'This save the settings to the registry at a specific VB key
SaveSetting "REGTEST", "TESTSECTION", "TESTKEY", "Test Value"
'It read that specific VB Key
MsgBox objReg.RegRead(strKey), , "We just set this value with SaveSetting"
'Now it overwrite the value
objReg.RegWrite strKey, "Test Value modified by RegWrite"
'Read it again
MsgBox objReg.RegRead(strKey), , "Value using WshShell.RegRead"
MsgBox GetSetting("REGTEST", "TESTSECTION", "TESTKEY"), , "Value with GetSetting"
'Now Delete the Key, notice I delete the whole section and not just the key
objReg.RegDelete "HKEY_USERS\.DEFAULT\Software\VB and VBA Program Settings\REGTEST\"
'Read it again, but it don't exist anyway
MsgBox objReg.RegRead(strKey), , "This line return an error"
Set objReg = Nothing
End Sub
Last edited by Cimperiali; November 22nd, 2003 at 05:12 AM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
I found something else on Windows 2000 Server with WshShell object as . The App accessed the registry run-time, and the error occirred in only windows 2000 Server. I found some articles that said 'missing component'. I am not sure it is true. I have tested reliable cabinet file deployment, but I got the same error.
Have you run some Apps which has WshShell with Registry Access? Did you got the error 429?
Please let me know.
Thanks a lot
Is there a way of getting Visual Basic to completely erase a part of the registry?
For example, I have a key at HKEY_CURRENT_USER\Software\AAA Software\DefaultSettings\Top which has a value of 1.
I want to totally delete (not over-write) everything under HKEY_CURRENT_USER\Software\AAA so that it doesn't exist anymore. I may not know every sub key, so I can't do each bit individually.
I've tried the code at http://www.codeguru.com/forum/showth...postid=848248, I've tried Microsoft's suggestion of using WshShell and I've tried a program found on this forum (playregistry) but none will delete what I'm looking for
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.