关于vbs WebBrowser导航问题
时间:2021-04-04 10:13:52|栏目:VBS|点击: 次
实际上属于转贴。。呵呵:-)
原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。
原文的中文地址是:
http://support.microsoft.com/kb/185538/zh-cn
实际上,这个实现就是获取一个接口,还是叫事件吧。。。。更明显,反正我是分不清这些东西的。
Dim WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1
163的链接一般都是弹出窗口,就用163吧
Private Sub Form_Load()
Set Web_V1 = WebBrowser1.Object
WebBrowser1.Navigate2 "http://www.163.com/"
End Sub
如果你想知道弹出窗口的URL呢,那就
Private Sub Web_V1_NewWindow(ByVal URL As String, _
ByVal Flags As Long, _
ByVal TargetFrameName As String, _
PostData As Variant, _
ByVal Headers As String, _
Processed As Boolean)
Processed = False
MsgBox URL
End Sub
如果你想让弹出窗口在原来的窗体里显示呢,就
Private Sub Web_V1_NewWindow(ByVal URL As String, _
ByVal Flags As Long, _
ByVal TargetFrameName As String, _
PostData As Variant, _
ByVal Headers As String, _
Processed As Boolean)
Processed = True
WebBrowser1.Navigate URL
End Sub
原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。
原文的中文地址是:
http://support.microsoft.com/kb/185538/zh-cn
实际上,这个实现就是获取一个接口,还是叫事件吧。。。。更明显,反正我是分不清这些东西的。
Dim WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1
163的链接一般都是弹出窗口,就用163吧
Private Sub Form_Load()
Set Web_V1 = WebBrowser1.Object
WebBrowser1.Navigate2 "http://www.163.com/"
End Sub
如果你想知道弹出窗口的URL呢,那就
Private Sub Web_V1_NewWindow(ByVal URL As String, _
ByVal Flags As Long, _
ByVal TargetFrameName As String, _
PostData As Variant, _
ByVal Headers As String, _
Processed As Boolean)
Processed = False
MsgBox URL
End Sub
如果你想让弹出窗口在原来的窗体里显示呢,就
Private Sub Web_V1_NewWindow(ByVal URL As String, _
ByVal Flags As Long, _
ByVal TargetFrameName As String, _
PostData As Variant, _
ByVal Headers As String, _
Processed As Boolean)
Processed = True
WebBrowser1.Navigate URL
End Sub
栏 目:VBS
下一篇:msxml3.dll 错误 80070005 拒绝访问
本文标题:关于vbs WebBrowser导航问题
本文地址:http://www.codeinn.net/misctech/94113.html