PDA

Click to See Complete Forum and Search --> : Registry.............


Electroman
Sep 10th, 2000, 08:19 AM
I am tring to get this too work:

Its the API to delete a Value.



Public Declare Function RegDeleteValue Lib "advapi32.dll" _
Alias "RegDeleteValueA" _
(ByVal hKey As Long, _
ByVal lpValueName As String) As Long



can anyone tell me if this is wrong ??

Dim
Sep 12th, 2000, 11:51 PM
Well you're missing the call for the API
Something like:

'Declx.
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003
Private Const HKEY_PERFORMANCE_DATA = &H80000004
Private Const ERROR_SUCCESS = 0&

Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal Hkey As Long, ByVal lpValueName As String) As Long

'On the Form

Public Function DeleteValue(ByVal Hkey As Long, ByVal strPath As String, ByVal strValue As String)
Dim keyhand As Long
r = RegOpenKey(Hkey, strPath, keyhand)
r = RegDeleteValue(keyhand, strValue)
r = RegCloseKey(keyhand)
End Function

Public Sub Command1_Click()
Call DeleteValue(HKEY_CURRENT_USER, "Software\myprogram\registry", "valuetodelete")
End Sub



Hope that helps,
D!m