I'm currently using the following code to set a proxy:

Code:
    Public Structure Struct_PROXY
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public pxyby As IntPtr
    End Structure

    Private Declare Auto Function InternetSetOption Lib "wininet.dll" (ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean

    Private Sub refreshproxy(ByVal strProxy As String)
        Const IOProxy As Integer = 38
        Const IProxy As Integer = 3
        Dim st_SP As Struct_PROXY

        st_SP.dwAccessType = IProxy
        st_SP.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy)
        st_SP.pxyby = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("Global")

        Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(st_SP))
        System.Runtime.InteropServices.Marshal.StructureToPtr(st_SP, intptrStruct, True)
        InternetSetOption(IntPtr.Zero, IOProxy, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(st_SP))

    End Sub
to call it I use:
Code:
refreshproxy(IP:PORT)
Setting the proxy works, but I can't seem to figure out how to disable it.

Any help is appreciated.