|
请教这段VB语句如何转换成为AU3(内嵌ie代理)
按下面的语句,倒腾半天没有结果,请教各位高手在内嵌的ie窗口如何实现代理(不要影响IE的)
例如:http://wenku.baidu.com/view/5f6c ... 4.html?from=related
设置程序中使用的WebBrowser控件的代理,不影响系统IE浏览器
简介:'在窗口中添加一个WebBrowser浏览器控件,添加两个文件框,改名为:txtIP、txtPort,分别为代理用品的IP及端口。一个按钮控件。代码如下: Option Explicit Private Type INTERNET_PROXY_INFO dwAccessType As Long ...
关键字:设置 程序 使用 WebBrowser 控件 代理 而不影响 系统 IE 浏览器
'在窗口中添加一个WebBrowser浏览器控件,添加两个文件框,改名为:txtIP、txtPort,分别为代理用品的IP及端口。一个按钮控件。代码如下:
Option Explicit
Private Type INTERNET_PROXY_INFO
dwAccessType As Long
lpszProxy As String
lpszProxyBypass As String
End Type
Private Const INTERNET_OPTION_PROXY = 38
Private Const INTERNET_OPTION_SETTINGS_CHANGED = 39
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const INTERNET_OPEN_TYPE_PROXY = 3
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
Private Sub SetProxy(aStrIP As String, aStrPort As String, aBolUseProxy As Boolean)
Dim strProxy As String
Dim inf As INTERNET_PROXY_INFO
aStrIP = Trim(aStrIP)
aStrPort = Trim(aStrPort)
If (aStrIP + aStrPort = "") Or Not aBolUseProxy Then
strProxy = ""
Else
strProxy = "http=" + aStrIP + ":" + aStrPort
End If
If Trim(strProxy) <> "" Then
inf.dwAccessType = INTERNET_OPEN_TYPE_PROXY
inf.lpszProxy = strProxy
inf.lpszProxyBypass = ""
Call InternetSetOption(0, INTERNET_OPTION_PROXY, inf, Len(inf))
Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, "", 0)
Else
inf.dwAccessType = INTERNET_OPEN_TYPE_DIRECT
inf.lpszProxy = ""
inf.lpszProxyBypass = ""
Call InternetSetOption(0, INTERNET_OPTION_PROXY, inf, Len(inf))
Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, "", 0)
End If
End Sub
Private Sub Command1_Click()
SetProxy txtIP.Text, txtPort.Text, True
WebBrowser1.Navigate "http://www.any5u.com"
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.any5u.com"
End Sub |
|