实际上属于转贴。。呵呵:-)
原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。
原文的中文地址是:
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