Kompletten Registry Schlüssel mit Unterschlüsseln löschen
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 RegDelKey(ByVal Root As HKEY_ROOTS, ByVal Path As String) As Boolean
Try
Select Case Root
Case 0 : Registry.ClassesRoot.DeleteSubKeyTree(Path)
Case 1 : Registry.CurrentUser.DeleteSubKeyTree(Path)
Case 2 : Registry.LocalMachine.DeleteSubKeyTree(Path)
Case 3 : Registry.Users.DeleteSubKeyTree(Path)
Case 4 : Registry.CurrentConfig.DeleteSubKeyTree(Path)
Case 5 : Registry.CurrentUser.DeleteSubKeyTree("Software\VB and VBA Program Settings\" & Path)
End Select
Return True
Catch ex As Exception
Return False
End Try
End Function
Kommentare zum Snippet