webbrowser 的一个高难问题
两个WebBrowser,如何写代码才能使得WebBrowser1的弹出窗口在WebBrowser1显示,并且WebBrowser2的弹出窗口在WebBrowser1显示? webbrowsr
[解决办法]
本帖最后由 bcrun 于 2013-11-11 11:06:06 编辑 这个没什么高难
Private WithEvents web As SHDocVwCtl.WebBrowser_V1
Private Sub Form_Load()
Set web = WebBrowser1.Object
Me.WebBrowser1.Navigate "www.baidu.com"
Me.WebBrowser2.Navigate "www.baidu.com"
End Sub
Private Sub web_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
web.Navigate URL
End Sub
Private Sub WebBrowser2_NewWindow2(ppDisp As Object, Cancel As Boolean)
WebBrowser1.RegisterAsBrowser = True
Set ppDisp = WebBrowser1.Object
End Sub