'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