Results 1 to 2 of 2

Thread: Edit DWORD value

  1. #1

    Thread Starter
    Junior Member JohannS's Avatar
    Join Date
    Aug 2001
    Location
    Pretoria, South Africa
    Posts
    21

    Angry Edit DWORD value

    I am trying to edit a dword value in the registry with the following code :


    Dim hkey As Long
    Dim c As Long
    Dim r As Long
    Dim s As String
    Dim t As Long

    r = RegOpenKeyEx(HKEY_CURRENT_USER, _
    "Software\Microsoft\Windows\CurrentVersion\Internet Settings", 0, KEY_READ, hkey)

    If r = 0 Then
    c = 255
    s = String(c, Chr(0))
    r = RegQueryValueExString(hkey, "AutoConfigURL", 0, t, s, c)

    s = ""
    r = RegSetValueExString(hkey, "AutoConfigURL", 0, REG_SZ, s, Len(s) + 1)
    End If
    r = 0

    If r = 0 Then
    c = 255
    s = String(c, Chr(0))
    r = RegQueryValueExString(hkey, "ProxyServer", 0, t, s, c)

    s = ""
    r = RegSetValueExString(hkey, "Proxyserver", 0, REG_SZ, s, Len(s) + 1)
    End If
    r = 0

    Dim lData As Long
    If r = 0 Then
    iDword = 0
    r = RegSetValueEx(hkey, "ProxyEnable", 0&, REG_DWORD, lData, 0) '(hkey, "ProxyEnable", 0, REG_DWORD, iDword, 0)
    End If

    r = RegCloseKey(hkey)


    I can save the string values but cant save the dword, please help
    It was an electrical problem sir, a conrod went through the block, and knocked the distributer off.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Last parameter should be the length of the value, in your case it is long, so it should be 4:
    VB Code:
    1. r = RegSetValueEx(hkey, "ProxyEnable", 0&, REG_DWORD, lData, 4)

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