这个小工具可以用来设置 ie浏览器的代理 ip,其实就是去修改注册表相关键值。。
理论上来说 ,只要是 使用ie内核的浏览器都可以,不过我没试。。。
下面上图,上代码,上程序
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.IO;
- namespace SetProxy
- {
- public partial class FormMain : Form
- {
- public FormMain()
- {
- InitializeComponent();
- }
- private void btn_SetProxy_Click(object sender, EventArgs e)
- {
- Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
- rk.SetValue("ProxyEnable", 1);
- rk.SetValue("ProxyServer", this.txt_ProxyIP.Text);
- rk.Close();
- MessageBox.Show("代理设置完成...");
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- Process[] myProcesses = System.Diagnostics.Process.GetProcesses();
- foreach (System.Diagnostics.Process myProcess in myProcesses)
- {
- if (myProcess.ProcessName.ToUpper() == "IEXPLORE")
- {
- myProcess.Kill();
- }
- }
- Process.Start("iexplore.exe", "http://www.baidu.com/s?wd=ip");
- }
- private void btn_UnSet_Click(object sender, EventArgs e)
- {
- Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
- rk.SetValue("ProxyEnable", 0);
- rk.Close();
- MessageBox.Show("代理已取消...");
- }
- private void btn_Input_Click(object sender, EventArgs e)
- {
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- string fn = openFileDialog1.FileName;
- // Create an instance of StreamReader to read from a file.
- // The using statement also closes the StreamReader.
- using (StreamReader sr = new StreamReader(fn))
- {
- String line;
- // Read and display lines from the file until the end of
- // the file is reached.
- while ((line = sr.ReadLine()) != null)
- {
- string[] temp = line.Split(':');
- ListViewItem item = new ListViewItem(new string [] {temp[0],temp[1] });
- listview_ip.Items.Add(item);
- }
- }
- }
- }
- private void listview_ip_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string ip = listview_ip.SelectedItems[0].SubItems[0].Text + ":" + listview_ip.SelectedItems[0].SubItems[1].Text;
- Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
- rk.SetValue("ProxyEnable", 1);
- rk.SetValue("ProxyServer", ip);
- rk.Close();
- Process[] myProcesses = System.Diagnostics.Process.GetProcesses();
- foreach (System.Diagnostics.Process myProcess in myProcesses)
- {
- if (myProcess.ProcessName.ToUpper() == "IEXPLORE")
- {
- myProcess.Kill();
- }
- }
- Process.Start("iexplore.exe", "http://www.myhack58.com/s?wd=ip");
- }
- }
- }
可导入代理,双击ip设置代理,也可在 文本框中填入代理设置,代理可以去代理网站抓取,同胞们可以写个代理抓取软件。
我把源码和 程序一起打包,只想要程序的,解压完成后,拷贝出 \SetProxy\bin\Release\SetProxy.exe就可以了。。
再给大家传点我刚检测完的http代理,代理可能几天过后就不能用了,大家自己去抓取。。。