| How to set a Proxy Server in IE Component. In an always greater number of applications, the browser component is very important to visualize web page or display banner that change fastly. So, in most cases is very good idea enabling proxy settings. You can use InteropServices in this way: using System.Runtime.InteropServices; ... //Define external method. [DllImport(\"wininet.dll\", SetLastError = true)] private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength); //Define your method. private void SetEmugleProxy(string Proxy) { const int OPTION_PROXY = 38; const int OPEN_TYPE_PROXY = 3; Struct_INTERNET_PROXY ip; ip.dwAccessType = OPEN_TYPE_PROXY; ip.proxy = Marshal.StringToHGlobalAnsi(Proxy); ip.proxyBypass = Marshal.StringToHGlobalAnsi(\"local\"); IntPtr intptrStruct = Marshal.AllocCoTaskMem(Marshal.SizeOf(ip)); // Converting structure to IntPtr. Marshal.StructureToPtr(ip, intptrStruct, true); bool iReturn = InternetSetOption(IntPtr.Zero, OPTION_PROXY, intptrStruct, Marshal.SizeOf(ip)); } --- Enjoy your code! :) |