Results 1 to 2 of 2
  1. #1
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused

    [Help]Proxy With WebBrowser[Solved]

    How would you use a proxy for webbrowser1.

  2. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    MSDN offers you the code..........(why doesn't anyone search...)

    MSDN Source Library:
    Code:
    ' The structure we use for the information
    ' to be interpreted correctly by API.
    Public Structure Struct_INTERNET_PROXY_INFO
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public proxyBypass As IntPtr
    End Structure
    
    ' The Windows API function that allows us to manipulate
    ' IE settings programmatically.
    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
    
    ' The function we will be using to set the proxy settings.
    Private Sub RefreshIESettings(ByVal strProxy As String)
        Const INTERNET_OPTION_PROXY As Integer = 38
        Const INTERNET_OPEN_TYPE_PROXY As Integer = 3
        Dim struct_IPI As Struct_INTERNET_PROXY_INFO
    
        ' Filling in structure
        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")
    
        ' Allocating memory
        Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    
        ' Converting structure to IntPtr
        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
    Code:
    RefreshIESettings("IP:port8080")
    Still have a problem... Pm me

    /closed


     


     


     



    The Most complete application MPGH will ever offer - 68%




Similar Threads

  1. [Help]problem with code[/solved]
    By pushdis15 in forum Visual Basic Programming
    Replies: 2
    Last Post: 04-08-2011, 06:41 AM
  2. i need help plz with hack[SOLVED]
    By yehialove in forum CrossFire Help
    Replies: 6
    Last Post: 08-12-2010, 08:45 PM
  3. [Help]Trouble with VB[Solved]
    By judaking3 in forum Visual Basic Programming
    Replies: 12
    Last Post: 07-23-2010, 10:11 PM
  4. [HELP] Me With My Spammer[/solved]
    By dylan40 in forum Visual Basic Programming
    Replies: 7
    Last Post: 04-19-2010, 10:12 AM
  5. C# Dealing with webbrowser images help.
    By Calebb in forum C++/C Programming
    Replies: 3
    Last Post: 01-02-2010, 11:16 PM