vbscript
Übersicht
Einführung
Unter VBA gibt es drei Möglichkeiten auf die Registry zuzugreifen:
Registry API (advapi32.dll)
über WMI
Auflisten von Ästen und Einträgen
Auflisten der Unteräste
ListAllSubBranches
Sub ListAllSubBranches(sPart As String, sPath As String, Optional brecursive As Boolean = False, Optional Levels As Integer = 0, Optional currentlevel As Integer = 0)Dim oReg: Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")Dim oShell: Set oShell = CreateObject("WScript.Shell")Dim aSub, sKey, aSubToo, sKeyToo, dwValue Select Case sPart Case "HKEY_CLASSES_ROOT" oReg.EnumKey &H80000000, sPath, aSub Case "HKEY_CURRENT_USER" oReg.EnumKey &H80000001, sPath, aSub Case "HKEY_LOCAL_MACHINE" oReg.EnumKey &H80000002, sPath, aSub Case "HKEY_USERS" oReg.EnumKey &H80000003, sPath, aSub Case "HKEY_CURRENT_CONFIG" oReg.EnumKey &H80000005, sPath, aSub End SelectIf Not IsNull(aSub) Then For Each sKey In aSub Dim tmpVar As String If Not Right(sPath, 1) = "\" Then tmpVar = sPath & "\" & CStr(sKey) Else tmpVar = sPath & CStr(sKey) End If Debug.Print tmpVar & " [Level: " & currentlevel & "]" If brecursive = True Then If Levels > 0 And currentlevel < Levels Then Call ListAllSubKeys(sPart, tmpVar, brecursive, Levels, currentlevel + 1) End If End If NextEnd IfEnd Sub
span style='color:#800000; font-weight:bold; '
Auflisten von Einträgen
Links
Registry Zugriffe ohne API
Registry Zugriffe mittels API
Verwenden der Registrierungs-API zum Speichern und Abrufen von Einstellungen
Registry Zugriffe mittels WMI