help me . how to Use a sock 5 with webBrowser control C#

Discussion in 'C, C++, C#' started by format888, Apr 4, 2014.

  1. format888

    format888 Newbie

    Apr 4, 2014
    Likes Received:
    hi every body .
    I need some help from someone who has already use the webBrowser control along with a sock 5

    I'm using the code attached to set the sock into the webBrowser control,but seems to work only once during the execution, when I call it again in the loop it just doesn't work, I can get t ounderstand why.
    Hope some one could help me with this...

    my code :

    static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
    public struct Struct_INTERNET_PROXY_INFO

    public int dwAccessType;

    public IntPtr proxy;

    public IntPtr proxyBypass;
    public void RefreshIESettings(string strProxy)
    const int INTERNET_OPTION_PROXY = 38;
    const int INTERNET_OPEN_TYPE_PROXY = 3;
    s_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy);
    s_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("Global");
    IntPtr intptrStruct = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(s_IPI));
    System.Runtime.InteropServices.Marshal.StructureToPtr(s_IPI, intptrStruct, true);
    InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(s_IPI));
    Last edited: Apr 4, 2014