|
-
Jan 8th, 2009, 10:03 AM
#1
Thread Starter
Lively Member
Getting all sub keys from a registry value
Hi there,
Trying to do something I hope would be very simple (but maybe not!)
I am reading a registry key using the following code:
Code:
Dim registry As Object
Set registry = CreateObject("WScript.Shell")
Registry_Read = registry.RegRead(Key_Path & Key_Name)
End Function
Private Sub cmdgetemails_Click()
MsgBox Registry_Read("HKEY_CURRENT_USER\software\microsoft\windows\currentversion\unreadmail", "")
End Sub
What I want to do now is read all the sub keys in that particular key.. but im finding it extremely hard, is there is a simple way of doing this?
Many thanks
-
Jan 8th, 2009, 12:14 PM
#2
Re: Getting all sub keys from a registry value
 Originally Posted by Stanuk
is there is a simple way of doing this?
Debateable
WSH doesn't support registry enumeration. You can use WMI (.EnumKey), RegEnumKeyEx, SHEnumKeyEx, SHRegEnumUSKey or ZwEnumerateKey.
WMI is easiest. The rest are more reliable as they cannot be disabled by the user.
-
Jan 8th, 2009, 12:46 PM
#3
Re: Getting all sub keys from a registry value
Since the sample was missing:
Code:
Option Explicit
Private Sub Form_Load()
Dim Registry As Object, varKey As Variant, varKeys As Variant
Set Registry = GetObject("winmgmts:\\.\root\default:StdRegProv")
Registry.EnumKey &H80000001, "software\microsoft\windows\currentversion\unreadmail", varKeys
For Each varKey In varKeys
Debug.Print varKey
Next
End Sub
MSDN: EnumKey method of the StdRegProc class
-
Jan 8th, 2009, 02:59 PM
#4
Thread Starter
Lively Member
Re: Getting all sub keys from a registry value
That worked a treat, thankyou very much :-)
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
|