Results 1 to 2 of 2

Thread: Registry.............

  1. #1

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    I am tring to get this too work:

    Its the API to delete a Value.

    Code:
    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 ??

    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Well you're missing the call for the API
    Something like:
    Code:
    '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

    Dim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width