VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 使用VB获得一页的HTML代码
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:10457, 日期:2000-10-15
使用VB获得一页的HTML代码
   


  加入WebBrowser、Timer、CommandButton控件各一个,然后使用以下代码:

Private Sub Command1_Click()
    WebBrowser1.Navigate "http://www.programlife.com/"
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    Dim doc, objhtml As Object
    Dim i As Integer
    Dim strhtml As String
    
    If Not WebBrowser1.Busy Then
        Set doc = WebBrowser1.Document
        i = 0
        Set objhtml = doc.body.createtextrange()
        If Not IsNull(objhtml) Then
            Text1.Text = objhtml.htmltext
        End If
        Timer1.Enabled = False
    End If
End Sub