|
-
Mar 30th, 2010, 08:38 AM
#1
Thread Starter
New Member
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.
-
Mar 30th, 2010, 08:50 AM
#2
Hyperactive Member
Re: Disable Proxy In Web Browser
-- Please rate me if I am helpful --
-
Mar 30th, 2010, 09:01 AM
#3
Thread Starter
New Member
Re: Disable Proxy In Web Browser
 Originally Posted by cengineer
Thanks, but I still have the same problem.
I can enable the proxy but it wont disable.
-
Mar 31st, 2010, 06:57 AM
#4
Thread Starter
New Member
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?
-
May 20th, 2013, 09:00 AM
#5
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|