Results 1 to 3 of 3

Thread: Deleting registry strings

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    cape coral, fl, usa
    Posts
    7

    Post

    I have read about a million posts and I tell you, just about everything is covered. The only thing missing is deleting registry STRINGS. What I am tring to do is first put my app in the .\..\..CurrentVersion\run folder (which has been answered). Then I want to remove it. I know about the runonce key but I will need my program for quit a few reboots. If anyone could give a example as to how I can accomplish this I will be very thankful.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You need to use the RegDeleteKey and RegDeleteValue APIs, eg.

    To Remove a Value From a Key..
    Code:
    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 RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
    Private Const HKEY_LOCAL_MACHINE = &H80000002
    
    Private Sub Command1_Click()
        Dim lRegKey As Long
        Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\TestKey\", lRegKey)
        Call RegDeleteValue(lRegKey, "Test Value")
    End Sub
    To Delete an Entire Key or Key Structure..
    Code:
    Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
    Private Const HKEY_LOCAL_MACHINE = &H80000002
    
    Private Sub Command1_Click()
        Call RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\TestKey\")
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    cape coral, fl, usa
    Posts
    7

    Post

    Thank you very much for replying and thank you for such a great board.

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