Results 1 to 2 of 2

Thread: About Editing the registry...{Self Resolved, fix included}

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    About Editing the registry...{Self Resolved, fix included}

    Ok this one has me kinda stumped...

    I need my app to set a value in the registry under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

    I need to set the key "Enable Proxy"'s value to and from 1 & 0. Here's the fun part, it needs to be a REG_DWORD and when I set it with my code it is setting to a RED_SZ.

    I have tried a few different methods of setting it properly but it always accepts it as a string more or less and not a value. Here's some of the code I am using.
    VB Code:
    1. Function SetStringValue(SubKey As String, Entry As String, Value As String)
    2.  
    3. Call ParseKey(SubKey, MainKeyHandle)
    4.  
    5. If MainKeyHandle Then
    6.    rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey)
    7.    If rtn = ERROR_SUCCESS Then
    8.       rtn = RegSetValueEx(hKey, Entry, 0, REG_SZ, ByVal Value, Len(Value))
    9.       If Not rtn = ERROR_SUCCESS Then
    10.          If DisplayErrorMsg = True Then
    11.             MsgBox ErrorMsg(rtn)
    12.          End If
    13.       End If
    14.       rtn = RegCloseKey(hKey)
    15.    Else
    16.       If DisplayErrorMsg = True Then
    17.          MsgBox ErrorMsg(rtn)
    18.       End If
    19.    End If
    20. End If
    21. End Function
    22.  
    23. Sub Command1_Click()
    24.     SetStringValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 1
    25. End Sub
    Also, all the API's for the SetStringValue have been declared and the function works fine, just need it to set the value properly.

    If anyone can help me figure this out I will be very grateful.

    Thanx.
    Last edited by Spajeoly; Aug 3rd, 2003 at 05:43 AM.

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