如何用C#设置IE的代理
2011-04-29 13:56
274 查看
1 private void button3_Click(object sender, EventArgs e)
2 {
3 //打开注册表键
4 Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
5
6 //设置代理可用
7 rk.SetValue("ProxyEnable", 1);
8 //设置代理IP和端口
9 rk.SetValue("ProxyServer", this.textBox1.Text.ToString() + ":" + this.textBox2.Text.ToString());
rk.Close();
Factory.ExecuteNonQuery("update IP set area='1' where address= '" + str1 + "'");
this.dataGridView1.DataSource = Factory.GetDataTable("select * from ip");
MessageBox.Show("成功!!!");
}
private void button4_Click(object sender, EventArgs e)
{
//打开注册表键 www.elivn.com
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
//设置代理不可用
rk.SetValue("ProxyEnable", 0);
rk.Close();
MessageBox.Show("成功!!!");
}
2 {
3 //打开注册表键
4 Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
5
6 //设置代理可用
7 rk.SetValue("ProxyEnable", 1);
8 //设置代理IP和端口
9 rk.SetValue("ProxyServer", this.textBox1.Text.ToString() + ":" + this.textBox2.Text.ToString());
rk.Close();
Factory.ExecuteNonQuery("update IP set area='1' where address= '" + str1 + "'");
this.dataGridView1.DataSource = Factory.GetDataTable("select * from ip");
MessageBox.Show("成功!!!");
}
private void button4_Click(object sender, EventArgs e)
{
//打开注册表键 www.elivn.com
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
//设置代理不可用
rk.SetValue("ProxyEnable", 0);
rk.Close();
MessageBox.Show("成功!!!");
}
相关文章推荐
- 如何用C#设置IE的代理
- 如何用C#设置IE的代理
- 如何用C#设置IE的代理
- 如何用C#设置IE的代理
- Windows 10 使用C#如何将IE设置为默认浏览器
- c#在win7下设置IE代理第一次成功,第二次不成功的问
- C# 设置ie代理
- IE 11 如何设置“用户代理字符串”
- c#如何在win7下设置IE代理的完美解决方案
- C#设置IE代理
- C#设置IE代理及遇到问题的解决方案
- C#设置IE代理
- C#设置IE代理和使用代理访问网页
- 如何在Android程序中设置代理
- C#如何动态设置屏幕分辨率
- C#: 如何ListView 设置行高,不是办法的办法【转】
- C# 设置webbrowser 引用的IE版本
- C# winform如何设置ListBox背景图或者透明背景及边框色
- WebBrowser与IE的关系,如何设置WebBrowser工作在IE9、10、11模式下?
- WebBrowser与IE的关系,如何设置WebBrowser工作在IE9模式下?