Hur tar man bort en hel nyckel från registret? Tex HKEY_CURRENT_USER\Software\App... HejTa bort nyckel
Jag har testat med cRegistry.cls (http://www.vbaccelerator.com/codelib/inireg/registry.htm) och den här koden:
<code>
Dim c As New cRegistry
With c
.ClassKey = HKEY_CURRENT_USER
.SectionKey = "Software\App"
.DeleteKey
End With
</code>
men det fungerar inte... har jag förstått fel?
ThomasSv: Ta bort nyckel
Använd ett API.
Här är ett antal användbara functioner när man jobbar mot registret.
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
//Per Arne