|
-
Jun 25th, 2000, 10:42 AM
#1
Thread Starter
Member
I've been searching and trying to figure out
how to get all the values in a specific place
in the registery, I need a code to retrieve
both the Name and Data. Thanks in advance.
Sincerely,
Matthew Howle
-
Jun 25th, 2000, 11:30 AM
#2
Hyperactive Member
Have a look for the API call "RegEnumValue"
-
Jun 25th, 2000, 11:41 AM
#3
Thread Starter
Member
I got that part, but I just can't get the functions to work.
-
Jun 25th, 2000, 12:10 PM
#4
Hyperactive Member
Excuse any typing errors but I am having to copy this from a different screen without the lovely abilty to cut'n'paste :-(
Code:
Function ScanRegNode(sKeyName as String, ByRef colReturn as Collection, Optional hRoot as Long = HKEY_CURRENT_USER) as Long
Dim lngKeyHandle as Long
Dim lngResult as Long
Dim lngCurIdx as Long
Dim strValue as String
Dim lngValueLen as Long
Dim lngData as Long
Dim lngDataLen as Long
Dim strResult as String
On Error Goto ScanError
lngResult = RegOpenKeyEx(hRoot, sKeyName, 0&, KEY_READ, lngKeyHandle)
If lngResult <> 0 ERROR_NONE Then
Msgbox "Cannot Open Key"
Exit Function
End If
lngCurIdx = 0
Do
lngValueLen = 2000
strValue = String(lngValueLen, 0)
lngDataLen = 2000
lngResult = RegEnumValue(lngKeyHandle, lngCurIdx, ByVal strValue, lngValueLen, 0&, REG_WORD, ByVal lngData, lngDataLen)
lngCurIdx = lngCurIdx + 1
If lngResult = ERROR_NONE Then
strResult = Left(strValue, lngValueLen)
coReturn.Add Item:=strResult
End If
Loop While lngResult = ERROR_NONE
RegCloseKey (lngKeyHandle)
Exit Function
ScanError:
ScanRegNode = Err.Number
End Function
Of course you need to find out all the Constants and the declarations of the API's but that is straight forward.
What this does is give you a collection of the keys that exist underneath the name you stated. From there you can cycle through each one and get the actual value.
Does that help?
-
Jun 25th, 2000, 12:22 PM
#5
Thread Starter
Member
Yeah, thanks.
This is new to me and all. Can you please explain
the colReturn As Collection part? I just
don't understand what's it asking for. Thanks again
-
Jun 25th, 2000, 12:56 PM
#6
Hyperactive Member
colReturn is a collection which means you need to pass it a collection
ie :
Code:
Dim cKeys as New Collection
Dim i as Integer
Dim sMsg as String
If ScanRegNode("MyApp/Parameters", cKeys) = 0 Then
For i = 1 to cKeys.Count
sMsg = "Key #" & i & " is " & cKeys(i) & vbcr
Next i
msgbox sMsg
End If
A collection is like a linked list... it is a dynamically expanding array if you like
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
|