Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- namespace Webbrowser_Proxy
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- [DllImport("wininet.dll", SetLastError = true)]
- private static extern bool InternetSetOption(
- IntPtr dwL,
- int dw,
- IntPtr dwB,
- int dwBL
- );
- public struct SIPI
- {
- public int dwAT;
- public IntPtr pro;
- public IntPtr prB;
- }
- private void UseProxy(string Proxy)
- {
- const int PO = 38;
- const int POI = 3;
- SIPI ISI = default(SIPI);
- ISI.dwAT = POI;
- ISI.pro = Marshal.StringToHGlobalAnsi(Proxy);
- ISI.prB = Marshal.StringToHGlobalAnsi("local");
- IntPtr INS = Marshal.AllocCoTaskMem(Marshal.SizeOf(ISI));
- Marshal.StructureToPtr(ISI, INS, true);
- bool iR = InternetSetOption(IntPtr.Zero, PO, INS, Marshal.SizeOf(ISI));
- }
- private void button1_Click(object sender, EventArgs e)
- {
- webBrowser1.Navigate(textBox1.Text);
- }
- private void button2_Click(object sender, EventArgs e)
- {
- UseProxy(textBox3.Text);
- label4.Text = textBox3.Text;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement