如何使用VB来修改IE的IP代理服务器的地址及端口号

'VB设置IE代理服务器
Private Declare Function internetsetoption Lib "wininet.dll" Alias "InternetSetOptionA" _
  (ByVal hinternet As Long, ByVal dwoption As Long, ByRef lpbuffer As Any, ByVal dwbufferlength As Long) As Long

'proxyaddress=192.168.1.1:80格式
'isEnable为TRUE时设置代理服务器,为FALSE时取消
Public Function ChangProxy(ProxyAddress As String, isEnable As Boolean)
If isEnable Then
    ModRW_Reg.SetStringValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", ProxyAddress

    ModRW_Reg.SetDWORDValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 1
Else
    ModRW_Reg.DelValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer"
    ModRW_Reg.SetDWORDValue "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 0
End If
    '写入注册表后调用,即可不重启IE实现代理地址的更换
    Call internetsetoption(0, 39, 0, 0)
End Function
 
发布了175 篇原创文章 · 获赞 1 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览