-1

我在 vb 6.0 中有一个命令按钮,现在单击该命令按钮我想读取 URL 的内容(表示该 URL 在那里写的内容)。

代码:

Private Sub Command2_Click()
Dim obj As Object
Set obj = CreateObject("InternetExplorer.Application")

obj.Navigate2 "http://10.0.0.13/tuvrandom"
obj.Visible = True
End Sub

它将显示该页面的内容,例如:“google”,但我想阅读该页面所写的全部内容。

4

1 回答 1

1
Private Sub Command2_Click()
    Dim obj As Object

    Set obj = CreateObject("InternetExplorer.Application")

    obj.Navigate2 "http://10.0.0.13/tuvrandom"
    obj.Visible = True
    While obj.Busy Or obj.ReadyState <> 4
        DoEvents
    Wend

    ' read the document property for what you want
    ' text = obj.Document.Body.InnerHtml
End Sub

您可以在此处探索 Internet Explorer 对象模型, http: //msdn.microsoft.com/en-us/library/ms970456.aspx

于 2013-05-21T14:48:39.447 回答