Results 1 to 4 of 4

Thread: Modify Registry

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    418

    Modify Registry

    I have a VB6 app that modifies the Registry running on XP. If I run this same app on W8.1 will it do the same without errors.

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,631

    Re: Modify Registry

    What part of the Registry (which main key) is being modified?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2017
    Posts
    418

    Re: Modify Registry

    Main Form

    Code:
      '
      '
     hKey = CLng("&H80000001") ' = HKEY_CURRENT_USER\
     SetValue hKey, "Software\Ahead\Nero ShowTime\Settings", "BookmarksFileName", Dir1.Path & "\NeroShowTime.bmk"
     SetValue hKey, "Software\Ahead\Nero ShowTime\Settings", "CaptureFolder", Dir1.Path & "\"
      '
      '
    .BAS Module

    Code:
      '
      '
    Public Sub SetValue(hKey As Long, RegistryKey As String, SubKey As String, KeyValue As String)
     Dim KeyID As Long
     Dim plStatus As Long
    
     '
     ' Make sure all required properties have been set
     '
     If Len(RegistryKey) = 0 Then
       '
       ' The key property is not set, so flag an error
       '
       MsgBox GetErrorText(REGAGENT_NOKEY)
       Exit Sub
     End If
     
     If Len(SubKey) = 0 Then
       '
       ' The sub key property is not set, so flag an error
       '
       MsgBox GetErrorText(REGAGENT_NOSUBKEY)
       Exit Sub
     End If
     
     '
     ' Open the key by attempting to create it. If it
     ' already exists we get back an ID.
     '
     plStatus = RegCreateKey(hKey, _
                             RegistryKey, _
                             KeyID)
    
     If plStatus <> 0 Then
       '
       ' Call failed, can't open the key so exit
       '
       MsgBox GetErrorText(plStatus)
       Exit Sub
     End If
     
     If Len(KeyValue) = 0 Then
       '
       ' No key value, so clear any existing entry
       '
       plStatus = RegSetValueEx(KeyID, _
                                SubKey, _
                                0&, _
                                REG_SZ, _
                                0&, _
                                0&)
       If plStatus <> 0 Then
         MsgBox GetErrorText(plStatus)
       End If
     Else
       '
       ' Set the registry entry to the value
       '
       plStatus = RegSetValueEx(KeyID, _
                                SubKey, _
                                0&, _
                                REG_SZ, _
                                ByVal KeyValue, _
                                Len(KeyValue) + 1)
       If plStatus <> 0 Then
         MsgBox GetErrorText(plStatus)
       End If
     End If
    End Sub
      '
      '

  4. #4
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,631

    Re: Modify Registry

    Keys under HKEY_CURRENT_USER should not be giving you trouble unless Nero changed the owner to a different user than the logged in one.

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