VB6.0: 求获取某个网页所有HTML的代码

如题所述

'使用 URLDownloadToFile 这个API可以实现你想要的功能。
'声明API函数
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
'下载网页源码
Public Function DownloadFile(ByVal strURL As String, ByVal strFile As String) As Boolean
   Dim lngReturn                   As Long
   
   lngReturn = URLDownloadToFile(0, strURL, strFile, 0, 0)
   If lngReturn = 0 Then DownloadFile = True
End Function
Private Sub Command1_Click()
   Debug.Print DownloadFile("http://zhidao.baidu.com/question/12376048.html", "D:\1.html")
End Sub


或者使用WinHTTP、XMLHTTP对象

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-10-08
用狐火浏览器打开网站 点击右键 另存为,保存全部网页。本回答被网友采纳
第2个回答  2014-10-09
直接按字符流读取文件就好了啊
第3个回答  2014-10-09
百度上找仿站小工具 可以直接下载包括代码 css js 和图片
第4个回答  2014-10-09
可以介绍给你一个工具,单页扒手工具。