VB下载网页源码

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:23:37
使用
Inet1.OpenURL("") 下载居然下不完整源码。怎么搞的?

有其他办法吗?

使用 URLDownloadToFile 这个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