Jun 20th, 2005, 08:09 PM
#1
Thread Starter
Fanatic Member
Read Registry Keys
I want to search a section of the registry, and change keys after the key is read, how do I do that?
For example: I want to read all of the keys that are to open on Windows reboot, and add them to a listbox.
I can read 1 key just fine, but how do I change keys?
Thanks,
Sir Loin
Last edited by Sir Loin; Jun 20th, 2005 at 08:45 PM .
Jun 20th, 2005, 08:13 PM
#2
Fanatic Member
Re: Changing Files
The attached module has an example of enumerating all subkeys at the top of it.
edit
It also has an example of getting all of the values in any given subkey
Attached Files
Last edited by anotherVBnewbie; Jun 20th, 2005 at 08:15 PM .
Reason: Correction
Jun 20th, 2005, 08:16 PM
#3
Re: Changing Files
Change your thread title - it's misleading ...
Jun 21st, 2005, 12:43 PM
#4
Thread Starter
Fanatic Member
Re: Read Registry Keys
Thanks, it works great!
I have one question though, what is lKeyValue's purpose in this code, its value is 0, right? but the code doesn't work if you replace Ikeyvalue with 0's, why?
VB Code:
Public Function ReadRegistryGetSubkey(ByVal Group As Long, ByVal Section As String, Idx As Integer) As String
Dim lResult As Long, lKeyValue As Long, lDataTypeValue As Long, lValueLength As Long, sValue As String, td As Double
On Error Resume Next
lResult = RegOpenKey(Group, Section, lkeyvalue)
sValue = Space$(2048)
lValueLength = Len(sValue)
lResult = RegEnumKey(lKeyValue, Idx, sValue, lValueLength)
If (lResult = 0) And (Err.Number = 0) Then
sValue = Left$(sValue, InStr(sValue, Chr(0)) - 1)
Else
sValue = "Not Found"
End If
lResult = RegCloseKey(lKeyValue)
ReadRegistryGetSubkey = sValue
End Function
Thanks,
SIR LOIN
Jun 21st, 2005, 04:58 PM
#5
Addicted Member
Re: Read Registry Keys
lKeyValue is a variable and once it reads the registry key it will be changed from 0 to some other number. If you type 0 in it's place it won't work.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width