vb6动态创建webbrowser

Option Explicit
Private WithEvents IE As VBControlExtender

Private Sub Command1_Click()
    Dim IE
    Set IE = Me.Controls.Add("Shell.Explorer.2", "IE", Me)
    IE.Top = 0
    IE.Left = 0
    IE.Width = 5000
    IE.Height = 5000
    IE.Width = Me.ScaleWidth
    IE.Height = Me.ScaleHeight
    IE.Visible = 1
    Dim WebBrowser
    Set WebBrowser = IE.Object
    WebBrowser.Silent = True
    WebBrowser.Navigate "http://www.baidu.com"
End Sub

Private Sub IE_ObjectEvent(Info As EventInfo)
    Debug.Print Info.Name
End Sub

Private Sub Command2_Click()
    Debug.Print IE.object.document.All(0).outerHTML ‘获取真正的网页源码
End Sub

 

posted on 2014-08-21 10:25  空明流光  阅读(873)  评论(0编辑  收藏  举报

导航