Results 1 to 5 of 5

Thread: Disable Proxy In Web Browser

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    11

    Disable Proxy In Web Browser

    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.

  2. #2
    Hyperactive Member
    Join Date
    Nov 2008
    Location
    USA
    Posts
    257

    Re: Disable Proxy In Web Browser

    -- Please rate me if I am helpful --

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    11

    Re: Disable Proxy In Web Browser

    Quote Originally Posted by cengineer View Post
    Thanks, but I still have the same problem.

    I can enable the proxy but it wont disable.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    11

    Re: Disable Proxy In Web Browser

    Sorry for the bump / double post but I doubt I'm gonna get help with this if it's on the 3rd page.

    Does anybody know a solution?

  5. #5
    New Member dennis kon's Avatar
    Join Date
    May 2013
    Location
    Athens
    Posts
    1

    Re: Disable Proxy In Web Browser

    i know this is old thread but someone might find it useful
    Code:
    Imports Microsoft.Win32
    '
    '
    '
    '
    Private Sub disableproxy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles disableproxy.Click
           'Connect to the registry and disable the proxy
    
            Dim proxy As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
    
            proxy.SetValue("ProxyEnable", 0)
    
        End Sub

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