Dir50 Posted July 28, 2011 Posted July 28, 2011 Public Structure Struct_INTERNET_PROXY_INFO Public dwAccessType As Integer Public proxy As IntPtr Public proxyBypass As IntPtr End Structure <Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _ Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean End Function Private Sub PROXYSET(ByVal strProxy As String) WebBrowser1.ScriptErrorsSuppressed = True Const INTERNET_OPTION_PROXY As Integer = 38 Const INTERNET_OPEN_TYPE_PROXY As Integer = 3 Dim struct_IPI As Struct_INTERNET_PROXY_INFO struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY struct_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy) struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local") Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) System.Runtime.InteropServices.Marshal.StructureToPtr(struct_IPI, intptrStruct, True) Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) End Sub You will make a button , duble click it and Dim proxy as string = "Proxy IP" PROXYSET(proxy) Dim proxy as string = "xxx.xxx.xxx.xxx:8080" 'or "xxx.xxx.xxx.xxx:80" After that you can open every site and your ip will be : xxx.xxx.xxx.xxx Thats all , enjoy Quote
eleinoC Posted July 28, 2011 Posted July 28, 2011 φιλε το WebBrowser1.ScriptErrorsSuppressed = True Const INTERNET_OPTION_PROXY As Integer = 38 Const INTERNET_OPEN_TYPE_PROXY As Integer = 3 Dim struct_IPI As Struct_INTERNET_PROXY_INFO struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY struct_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy) struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local") Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) System.Runtime.InteropServices.Marshal.StructureToPtr(struct_IPI, intptrStruct, True) Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)) End Sub που το βαζω? το δευτερο script μπαινει στο button το πρωτo? Quote
Stealth Posted July 28, 2011 Posted July 28, 2011 Έχω την εντύπωση ότι το proxy αυτό λειτουργεί μόνο για I.E. όμως. Quote
Dir50 Posted July 28, 2011 Author Posted July 28, 2011 Έχω την εντύπωση ότι το proxy αυτό λειτουργεί μόνο για I.E. όμως. swsta , aytos to 8elei gia idi iparxon webbrowser , aytos o (default) webbrowser pou xrisimopoiei to .net framework einai o IE opote den iparxei provlima :) Quote
Stealth Posted July 29, 2011 Posted July 29, 2011 swsta , aytos to 8elei gia idi iparxon webbrowser , aytos o (default) webbrowser pou xrisimopoiei to .net framework einai o IE opote den iparxei provlima :) Ναι αλλά έχω την εντύπωση ότι χρειάζεται restart o browser ή refresh της σελίδας για να λειτουργήσει ο proxy (αν θυμάμαι καλά γιατί έχω ξαναχρησιμοποιήσει το API αυτό νομίζω.) διόρθωσε με αν κάνω λάθος. Quote
Dir50 Posted July 30, 2011 Author Posted July 30, 2011 ΔIKAIO EXEIΣ . ΓIA AYTO KANEIΣ ΠPΩTA ΣET KAI META APXIZEIΣ TON browser (sorry ΓIA TA caps EIMAI AΠO KINHTO) Quote
Sponz Posted July 30, 2011 Posted July 30, 2011 ΔIKAIO EXEIΣ . ΓIA AYTO KANEIΣ ΠPΩTA ΣET KAI META APXIZEIΣ TON browser (sorry ΓIA TA caps EIMAI AΠO KINHTO) xaxaxaxaxaxaax bro sinexise etsi ;) cool codes Quote
saYRam Posted September 26, 2011 Posted September 26, 2011 C# version of code pieces public struct Struct_INTERNET_PROXY_INFO { public int dwAccessType; public IntPtr proxy; public IntPtr proxyBypass; } [Runtime.InteropServices.DllImport("wininet.dll", SetLastError = true)] private static bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength) { } private void PROXYSET(string strProxy) { WebBrowser1.ScriptErrorsSuppressed = true; const int INTERNET_OPTION_PROXY = 38; const int INTERNET_OPEN_TYPE_PROXY = 3; Struct_INTERNET_PROXY_INFO struct_IPI = default(Struct_INTERNET_PROXY_INFO); struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY; struct_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy); struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local"); IntPtr intptrStruct = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)); System.Runtime.InteropServices.Marshal.StructureToPtr(struct_IPI, intptrStruct, true); bool iReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI)); } string proxy = "Proxy IP"; [] PROXYSET = new[]; //or "xxx.xxx.xxx.xxx:80" string proxy = "xxx.xxx.xxx.xxx:8080"; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.