Option ExplicitPrivate 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
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000Public Function DownloadFile(sSourceUrl As String, _
sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, _
sSourceUrl, _
sLocalFile, _
BINDF_GETNEWESTVERSION, _
0&) = ERROR_SUCCESS
End FunctionPrivate Sub Command1_Click()
Dim sSourceUrl As String
Dim sLocalFile As String
sSourceUrl = "ftp://118.123.8.122/bte.ini"
sLocalFile = "d:\bte.ini"
If DownloadFile(sSourceUrl, sLocalFile) Then
MsgBox "下载成功"
End If
End Sub
‘------------------
用以上代码从服务器下载了 bte.ini 到本地硬盘后发现,每次下载的文件内容都是一样的,没有得到更新,实际情况,ini是一直在更新,请问为什么有这种情况?
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000Public Function DownloadFile(sSourceUrl As String, _
sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, _
sSourceUrl, _
sLocalFile, _
BINDF_GETNEWESTVERSION, _
0&) = ERROR_SUCCESS
End FunctionPrivate Sub Command1_Click()
Dim sSourceUrl As String
Dim sLocalFile As String
sSourceUrl = "ftp://118.123.8.122/bte.ini"
sLocalFile = "d:\bte.ini"
If DownloadFile(sSourceUrl, sLocalFile) Then
MsgBox "下载成功"
End If
End Sub
‘------------------
用以上代码从服务器下载了 bte.ini 到本地硬盘后发现,每次下载的文件内容都是一样的,没有得到更新,实际情况,ini是一直在更新,请问为什么有这种情况?
ftp清缓存就不懂怎么弄了
前面加句:
DeleteUrlCacheEntry(sSourceUrl)