Implement Proxy to Webbrowser [vb .net]

Status
Not open for further replies.

Lightness

Banned
Original poster
Joined
Jul 5, 2011
Posts
6,514
Reaction score
1,773
Points
0
Location
SF Bay Area
Hi, I need help with implementing proxies to my webbrowser in visual basic. i found a code on youtube, it works, but i really don't how to turn it off, so i wanna know how to implement proxies. kthxbai
 

goku93

Senior
senior
member
Joined
Jun 13, 2011
Posts
465
Reaction score
81
Points
146
Im in the same as you xD i found this code try it :p

Code:
[COLOR=#7AC07C]Public [/COLOR][COLOR=#66CCFF]Structure Struct_INTERNET_PROXY_INFO
  [/COLOR][COLOR=#7AC07C]Public [/COLOR][COLOR=#66CCFF]dwAccessType [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Integer
  [/COLOR][COLOR=#7AC07C]Public [/COLOR][COLOR=#66CCFF]proxy [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]IntPtr
  [/COLOR][COLOR=#7AC07C]Public [/COLOR][COLOR=#66CCFF]proxyBypass [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]IntPtr
    End Structure
    [/COLOR][COLOR=#7AC07C]<[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]DllImport[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#FF99FF]"wininet.dll"[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]SetLastError[/COLOR][COLOR=#7AC07C]:=[/COLOR][COLOR=#66CCFF]True[/COLOR][COLOR=#7AC07C])> [/COLOR][COLOR=#66CCFF]_
    [/COLOR][COLOR=#7AC07C]Private [/COLOR][COLOR=#66CCFF]Shared [/COLOR][COLOR=#7AC07C]Function [/COLOR][COLOR=#66CCFF]InternetSetOption[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]ByVal hInternet [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]IntPtr[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]ByVal dwOption [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Integer[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]ByVal lpBuffer [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]IntPtr[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]ByVal lpdwBufferLength [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Integer[/COLOR][COLOR=#7AC07C]) As [/COLOR][COLOR=#66CCFF]Boolean
    End [/COLOR][COLOR=#7AC07C]Function

    Private [/COLOR][COLOR=#66CCFF]Sub PROXYSET[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]ByVal strProxy [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]String[/COLOR][COLOR=#7AC07C])
  [/COLOR][COLOR=#66CCFF]WebBrowser1[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]ScriptErrorsSuppressed [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]True
  [/COLOR][COLOR=#7AC07C]Const [/COLOR][COLOR=#66CCFF]INTERNET_OPTION_PROXY [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Integer [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]38
  [/COLOR][COLOR=#7AC07C]Const [/COLOR][COLOR=#66CCFF]INTERNET_OPEN_TYPE_PROXY [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Integer [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]3
  Dim struct_IPI [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Struct_INTERNET_PROXY_INFO
  struct_IPI[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]dwAccessType [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]INTERNET_OPEN_TYPE_PROXY
  struct_IPI[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]proxy [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]StringToHGlobalAnsi[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]strProxy[/COLOR][COLOR=#7AC07C])
  [/COLOR][COLOR=#66CCFF]struct_IPI[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]proxyBypass [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]StringToHGlobalAnsi[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#FF99FF]"local"[/COLOR][COLOR=#7AC07C])
  [/COLOR][COLOR=#66CCFF]Dim intptrStruct [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]IntPtr [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]AllocCoTaskMem[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]SizeOf[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]struct_IPI[/COLOR][COLOR=#7AC07C]))
  [/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]StructureToPtr[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]struct_IPI[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]intptrStruct[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]True[/COLOR][COLOR=#7AC07C])
  [/COLOR][COLOR=#66CCFF]Dim iReturn [/COLOR][COLOR=#7AC07C]As [/COLOR][COLOR=#66CCFF]Boolean [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#66CCFF]InternetSetOption[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]IntPtr[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Zero[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]INTERNET_OPTION_PROXY[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]intptrStruct[/COLOR][COLOR=#7AC07C], [/COLOR][COLOR=#66CCFF]System[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Runtime[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]InteropServices[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]Marshal[/COLOR][COLOR=#7AC07C].[/COLOR][COLOR=#66CCFF]SizeOf[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]struct_IPI[/COLOR][COLOR=#7AC07C]))
    [/COLOR][COLOR=#66CCFF]End Sub [/COLOR][COLOR=#66CCFF][/COLOR]


For Start is this
Code:
[COLOR=#66CCFF]Dim proxy [/COLOR][COLOR=#7AC07C]as [/COLOR][COLOR=#66CCFF]string [/COLOR][COLOR=#7AC07C]= [/COLOR][COLOR=#FF99FF]"Insert you're proxy here"
[/COLOR][COLOR=#66CCFF]PROXYSET[/COLOR][COLOR=#7AC07C]([/COLOR][COLOR=#66CCFF]proxy[/COLOR][COLOR=#7AC07C]) [/COLOR]


and for stop just leave in blank where is the proxy. Try it and response, i want to know if it work
 
Status
Not open for further replies.