Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Function GetSou(URL As String) As String
Const tmpfile As String = "c:\tmp.sou"
URLDownloadToFile 0, URL, tmpfile, 0, 0
Do Until FileLen(tmpfile)
DoEvents
Loop
Dim fn As Integer: fn = FreeFile
Open tmpfile For Binary Access Read As #fn
GetSou = Space(FileLen(tmpfile))
Get #fn, , GetSou
Close #fn
Kill tmpfile
End Function
Private Sub Command1_Click()
MsgBox GetSou("http://www.163.com")
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.163.com"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim i As Integer
Do Until WebBrowser1.Document.All.Item(i).tagName = "HTML"
i = i + 1
Loop
Dim s As String
s = WebBrowser1.Document.All.Item(i).outerHTML
MsgBox s
End Sub