實際上屬于轉貼。。呵呵:-) 原始文章來自微軟,微軟么,是大家的微軟嘛!所以稍微修改了一下,帖到這里。 原文的中文地址是: 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)