admin 管理员组文章数量: 887006
附C# VB.NET互转工具:https://download.csdn/download/xxxvxxv/10877188
Imports Microsoft.Win32.Registry
Class sysProxy
''' <summary>
''' 开启代理
''' </summary>
Public Sub open()
Dim RootKey As Microsoft.Win32.RegistryKey = CurrentUser
Dim SubKey As Microsoft.Win32.RegistryKey = RootKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings\", True)
SubKey.SetValue("ProxyEnable", &H1)
End Sub
''' <summary>
''' 设置代理服务器的地址跟端口
''' </summary>
''' <param name="str">如127.0.0.1:8888</param>
Public Sub setproxy(ByVal str As String)
Dim RootKey As Microsoft.Win32.RegistryKey = CurrentUser
Dim SubKey As Microsoft.Win32.RegistryKey = RootKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings\", True)
SubKey.SetValue("ProxyServer", str)
SubKey.SetValue("ProxyEnable", &H1)
End Sub
''' <summary>
''' 关闭代理
''' </summary>
Public Sub close()
Dim RootKey As Microsoft.Win32.RegistryKey = CurrentUser
Dim SubKey As Microsoft.Win32.RegistryKey = RootKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings\", True)
SubKey.SetValue("ProxyEnable", &H0)
End Sub
''' <summary>
''' 代理开关状态
''' </summary>
''' <param name="proxy"></param>
''' <returns></returns>
Public Function ProxyStatus(ByRef proxy As String) As Boolean
Dim RootKey As Microsoft.Win32.RegistryKey = CurrentUser
Dim SubKey As Microsoft.Win32.RegistryKey = RootKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings\", True)
proxy = SubKey.GetValue("ProxyServer")
Return SubKey.GetValue("ProxyEnable")
End Function
End Class
版权声明:本文标题:[.NET] Windows系统全局代理IP设置 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1734803796h1670698.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论