Alle Einträge eines Registryschlüssels enumerieren (aufzählen) und in einem Array speichern
Imports Microsoft.Win32
Public Enum HKEY_ROOTS As Integer
HKEY_CLASSES_ROOT = 0
HKEY_CURRENT_USER = 1
HKEY_LOCAL_MACHINE = 2
HKEY_USERS = 3
HKEY_CURRENT_CONFIG = 4
VB_AND_VBA_PROGRAM_SETTINGS = 5
End Enum
Public Function EnumValueNames(ByVal Root As HKEY_ROOTS, ByVal Path As String) As String()
Try
Select Case Root
Case 0 : Return Registry.ClassesRoot.OpenSubKey(Path).GetValueNames
Case 1 : Return Registry.CurrentUser.OpenSubKey(Path).GetValueNames
Case 2 : Return Registry.LocalMachine.OpenSubKey(Path).GetValueNames
Case 3 : Return Registry.Users.OpenSubKey(Path).GetValueNames
Case 4 : Return Registry.CurrentConfig.OpenSubKey(Path).GetValueNames
Case 5 : Return Registry.CurrentUser.OpenSubKey("Software\VB and VBA Program Settings\" & Path).GetValueNames
Case Else : Return Nothing
End Select
Catch ex As Exception
Return Nothing
End Try
End Function
Kommentare zum Snippet