手机
当前位置:查字典教程网 >编程开发 >C#教程 >C#自动设置IE代理服务器(翻墙软件)代码实现
C#自动设置IE代理服务器(翻墙软件)代码实现
摘要:C#自动设置IE代理服务器代码如下:复制代码代码如下:usingSystem;usingSystem.Collections.Generic...

C#自动设置IE代理服务器代码如下:

复制代码 代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Microsoft.Win32;

using System.Diagnostics;

namespace IE

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void mycheck()//通过读取注册表内"ProxyEnable"的值,确定程序启动时button1.text的值.

{

RegistryKey mykey = Registry.CurrentUser.OpenSubKey("SoftwareMicrosoftWindowsCurrentVersionInternet Settings", true);

string myget = mykey.GetValue("ProxyEnable").ToString();

if (myget == "0")//确定当前状态是启用还是禁用.

{

button1.Text = "已关闭";

}

else

{

button1.Text = "已打开";

}

}

private void button1_Click(object sender, EventArgs e)

{

RegistryKey mykey = Registry.CurrentUser.OpenSubKey("SoftwareMicrosoftWindowsCurrentVersionInternet Settings", true);

if (button1.Text == "已打开")// 关闭

{

mykey.SetValue("ProxyEnable", 0x0);

mykey.SetValue("ProxyServer", "");

button1.Text = "已关闭";//关闭goagent按钮不可用,防止程序出错.

}

else//打开

{

mykey.SetValue("ProxyEnable", 0x1);

mykey.SetValue("ProxyServer", "127.0.0.1:8087");

button1.Text = "已打开";

}

}

private void Form1_Load(object sender, EventArgs e)

{

mycheck();

button3.Enabled = false;

}

private void button2_Click(object sender, EventArgs e)//打开goagent

{

Process.Start("D:Program Filesgoagent-goagent-f0fabf7localgoagent.exe");

button2.Enabled = false;

button3.Enabled = true;

}

private void button3_Click(object sender, EventArgs e)//关闭goagent

{

Process.GetProcessesByName("goagent")[0].Kill();

Process.GetProcessesByName("python27")[0].Kill();

button2.Enabled = true;

button3.Enabled = false;

}

}

}

【C#自动设置IE代理服务器(翻墙软件)代码实现】相关文章:

C# 手动/自动保存图片的实例代码

C#中实现任意List的全组合算法代码

c#设计模式 适配器模式详细介绍

C#中控制远程计算机的服务的方法

C#开发Windows服务实例之实现禁止QQ运行

C#软件注册码的实现代码

C#索引器简单实例代码

c# 获得局域网主机列表实例

C#获取计算机名,IP,MAC信息实现代码

.net C# 实现任意List的笛卡尔乘积算法代码

精品推荐
分类导航