Ok I worked it out, I had to change a few things in there... For those interested here's the edited code from above I used.
VB Code:
  1. Type FILETIME
  2.     lLowDateTime    As Long
  3.     lHighDateTime   As Long
  4. End Type
  5.  Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  6. Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hkey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
  7. Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long
  8. Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  9. Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hkey As Long, ByVal lpSubKey As String) As Long
  10. Declare Function RegDeleteValue& Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hkey As Long, ByVal lpValueName As String)
  11. Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
  12. Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long
  13. Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long
  14. Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Long, lpcbData As Long) As Long
  15. Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
  16. Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long
  17. Declare Function RegSetValueExLong Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, ByVal cbData As Long) As Long
  18. Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long
  19.  
  20. Const ERROR_SUCCESS = 0&
  21. Const ERROR_BADDB = 1009&
  22. Const ERROR_BADKEY = 1010&
  23. Const ERROR_CANTOPEN = 1011&
  24. Const ERROR_CANTREAD = 1012&
  25. Const ERROR_CANTWRITE = 1013&
  26. Const ERROR_OUTOFMEMORY = 14&
  27. Const ERROR_INVALID_PARAMETER = 87&
  28. Const ERROR_ACCESS_DENIED = 5&
  29. Const ERROR_NO_MORE_ITEMS = 259&
  30. Const ERROR_MORE_DATA = 234&
  31.  
  32. Const HKEY_CLASSES_ROOT = &H80000000
  33. Const HKEY_CURRENT_USER = &H80000001
  34. Const HKEY_LOCAL_MACHINE = &H80000002
  35. Const HKEY_USERS = &H80000003
  36. Const HKEY_PERFORMANCE_DATA = &H80000004
  37. Const HKEY_CURRENT_CONFIG = &H80000005
  38. Const HKEY_DYN_DATA = &H80000006
  39.  
  40. Const REG_NONE = 0&
  41. Const REG_SZ = 1&
  42. Const REG_EXPAND_SZ = 2&
  43. Const REG_BINARY = 3&
  44. Const REG_DWORD = 4&
  45. Const REG_DWORD_LITTLE_ENDIAN = 4&
  46. Const REG_DWORD_BIG_ENDIAN = 5&
  47. Const REG_LINK = 6&
  48. Const REG_MULTI_SZ = 7&
  49. Const REG_RESOURCE_LIST = 8&
  50. Const REG_FULL_RESOURCE_DESCRIPTOR = 9&
  51. Const REG_RESOURCE_REQUIREMENTS_LIST = 10&
  52.  
  53. Global Const KEY_ALL_ACCESS = &H3F
  54.  
  55. Global Const REG_OPTION_NON_VOLATILE = 0
  56.  
  57. Const KEY_QUERY_VALUE = &H1&
  58. Const KEY_SET_VALUE = &H2&
  59. Const KEY_CREATE_SUB_KEY = &H4&
  60. Const KEY_ENUMERATE_SUB_KEYS = &H8&
  61. Const KEY_NOTIFY = &H10&
  62. Const KEY_CREATE_LINK = &H20&
  63. Const READ_CONTROL = &H20000
  64. Const WRITE_DAC = &H40000
  65. Const WRITE_OWNER = &H80000
  66. Const SYNCHRONIZE = &H100000
  67. Const STANDARD_RIGHTS_REQUIRED = &HF0000
  68. Const STANDARD_RIGHTS_READ = READ_CONTROL
  69. Const STANDARD_RIGHTS_WRITE = READ_CONTROL
  70. Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
  71. Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
  72. Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY
  73. Const KEY_EXECUTE = KEY_READ
  74.  
  75. Dim hkey As Long, MainKeyHandle As Long
  76. Dim rtn As Long, lBuffer As Long, sBuffer As String
  77. Dim lBufferSize As Long
  78. Dim lDataSize As Long
  79. Dim ByteArray() As Byte
  80. Private Type GUID
  81.     Data1 As Long
  82.     Data2 As Integer
  83.     Data3 As Integer
  84.     Data4(7) As Byte
  85. End Type
  86. Const DisplayErrorMsg = False
  87. ___________________________________________________
  88. Function SetStringSrealValue(Subkey As String, Entry As String, Value As Variant)
  89. Dim LngValue$
  90. Call ParseKey(Subkey, MainKeyHandle)
  91. LngValue = Value
  92. If MainKeyHandle Then
  93.    rtn = RegOpenKeyEx(MainKeyHandle, Subkey, 0, KEY_WRITE, hkey)
  94.    If rtn = ERROR_SUCCESS Then
  95.       rtn = RegSetValueEx(hkey, Entry, 0, REG_DWORD, LngValue, 4)
  96.       If Not rtn = ERROR_SUCCESS Then
  97.          If DisplayErrorMsg = True Then
  98.             MsgBox ErrorMsg(rtn)
  99.          End If
  100.       End If
  101.       rtn = RegCloseKey(hkey)
  102.    Else
  103.       If DisplayErrorMsg = True Then
  104.          MsgBox ErrorMsg(rtn)
  105.       End If
  106.    End If
  107. End If
  108. End Function
Then to set the value you simply put:
VB Code:
  1. SetStringSrealValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", Chr(1)
  2.  
  3. 'then to set it to 0 do this
  4.  
  5. SetStringSrealValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", ""

So, yea, that was fairly easy to fix.