用注册表管理IE代理设置
生活随笔
收集整理的這篇文章主要介紹了
用注册表管理IE代理设置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
[DllImport("wininet.dll", SetLastError = true)]private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
private void SetProxy(int iProxyOption){//打開注冊表 Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);//設置代理 iProxyOption(0-取消,1-打開) rk.SetValue("ProxyEnable", iProxyOption);//rk.SetValue("ProxyServer", "8.8.8.8:8000");//取消代理 //rk.SetValue("ProxyEnable", 0); rk.Flush(); //刷新注冊表 rk.Close();//激活代理設置 //InternetSetOption(0, 39, IntPtr.Zero, 0);//InternetSetOption(0, 37, IntPtr.Zero, 0);}
private void SetProxy(int iProxyOption){//打開注冊表 Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);//設置代理 iProxyOption(0-取消,1-打開) rk.SetValue("ProxyEnable", iProxyOption);//rk.SetValue("ProxyServer", "8.8.8.8:8000");//取消代理 //rk.SetValue("ProxyEnable", 0); rk.Flush(); //刷新注冊表 rk.Close();//激活代理設置 //InternetSetOption(0, 39, IntPtr.Zero, 0);//InternetSetOption(0, 37, IntPtr.Zero, 0);}
總結
以上是生活随笔為你收集整理的用注册表管理IE代理设置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在Jetson Nano上十行代码实现目
- 下一篇: 【考研英语语法】口语语法