change the registry, here is some C++ code:
Change Internet Proxy settings
http://www.codeproject.com/internet/changeproxy1.aspToggle Internet Proxy settings - an alternate approach
http://www.codeproject.com/internet/changeproxy2.asp
Change Internet Proxy settings
http://www.codeproject.com/internet/changeproxy1.aspToggle Internet Proxy settings - an alternate approach
http://www.codeproject.com/internet/changeproxy2.asp
解决方案 »
- 正交二维字符串数组初始化的几种问题
- 在app.config中 数据库密码包含‘&’字符的话 应该怎么处理?
- listview:动态添加列的数据和选中数据
- 求指点关于 IDE集成开发环境 的 设计与开发
- c#传值函数怎么写?
- web应用程序不能打开视图设计器。
- 复制一段网页内容(包括图片,链接等),用什么方法可以在winform里面把复制的内容粘贴过来呢?(就像word一样)
- 关于 FreeTextBox (急!)
- 關於如何獲取文件摘要信息
- treeview双击事件中,当单击节点前的"+"、"-"号时,总是出错,说是对象没有实例话。(在线等待)
- 一个关于C# .net 的问题
- 在点击超链的同时可以写事件吗?
netsh -c interface dump > c:\tt.txt
----------------------------------------------
#========================
# 接口配置
#========================
pushd interfacereset all
popd
# 接口配置结束# ----------------------------------
# 接口 IP 配置
# ----------------------------------
pushd interface ip
# "本地连接" 的接口 IP 配置set address name = "本地连接" source = static addr = 202.168.0.224 mask = 255.255.255.0
set address name = "本地连接" gateway = 192.168.0.1 gwmetric = 1
set dns name = "本地连接" source = static addr = 202.135.0.1
set wins name = "本地连接" source = static addr = none
popd
# 接口 IP 配置结束
无法得到代理服务的信息
以下是c#代码//申明windows api
[DllImport(@"wininet",
SetLastError=true,
CharSet=CharSet.Auto,
EntryPoint="InternetSetOption",
CallingConvention=CallingConvention.StdCall)]
public static extern bool InternetSetOption
(
int hInternet,
int dmOption,
IntPtr lpBuffer,
int dwBufferLength
);public static void SetProxy()
{
//打开注册表
RegistryKey regKey = Registry.CurrentUser;
string SubKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
RegistryKey optionKey = regKey.OpenSubKey(SubKeyPath,true);
//更改健值,设置代理,
optionKey.SetValue("ProxyEnable",1);
optionKey.SetValue("ProxyServer","192.168.1.85:80");
//激活代理设置
InternetSetOption(0,39,IntPtr.Zero,0);
InternetSetOption(0,37,IntPtr.Zero,0);
}
以下是c#代码//申明windows api
[DllImport(@"wininet",
SetLastError=true,
CharSet=CharSet.Auto,
EntryPoint="InternetSetOption",
CallingConvention=CallingConvention.StdCall)]
public static extern bool InternetSetOption
(
int hInternet,
int dmOption,
IntPtr lpBuffer,
int dwBufferLength
);public static void SetProxy()
{
//打开注册表
RegistryKey regKey = Registry.CurrentUser;
string SubKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
RegistryKey optionKey = regKey.OpenSubKey(SubKeyPath,true);
//更改健值,设置代理,
optionKey.SetValue("ProxyEnable",1);
optionKey.SetValue("ProxyServer","192.168.1.85:80");
//激活代理设置
InternetSetOption(0,39,IntPtr.Zero,0);
InternetSetOption(0,37,IntPtr.Zero,0);
}