dwAccessType As Long
lpszProxy As String
lpszProxyBypass As String
End Type
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Const INTERNET_OPTION_PROXY = 38
Private Const INTERNET_OPTION_SETTINGS_CHANGED = 39
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
Dim options As INTERNET_PROXY_INFO
options.dwAccessType = INTERNET_OPEN_TYPE_PROXY
options.lpszProxy = "SOCKS=IP:端口" '如果是http代理就是HTTP=IP:端口
options.lpszProxyBypass = ""
internetsetoption 0, INTERNET_OPTION_PROXY, options, LenB(options)
internetsetoption 0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0
读取注册表键值HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable
检测是否使用代理 0 or 1
读取注册表键值
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer
读取代理地址和端口
数据格式: http=127.0.0.1:8888https=127.0.0.1:8888
设置的话就不用我说了吧,直接设置属性就可以了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)