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.
Also, all the API's for the SetStringValue have been declared and the function works fine, just need it to set the value properly.VB Code:
Function SetStringValue(SubKey As String, Entry As String, Value As String) Call ParseKey(SubKey, MainKeyHandle) If MainKeyHandle Then rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) If rtn = ERROR_SUCCESS Then rtn = RegSetValueEx(hKey, Entry, 0, REG_SZ, ByVal Value, Len(Value)) If Not rtn = ERROR_SUCCESS Then If DisplayErrorMsg = True Then MsgBox ErrorMsg(rtn) End If End If rtn = RegCloseKey(hKey) Else If DisplayErrorMsg = True Then MsgBox ErrorMsg(rtn) End If End If End If End Function Sub Command1_Click() SetStringValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 1 End Sub
If anyone can help me figure this out I will be very grateful.
Thanx.




Reply With Quote