Câu hỏi

26/04/2013 21:29
Giúp em tạo cái nút Button [Cap Nhat] này với
Em muốn Đặt 1 Button [Cap Nhap] . Sau khi kich chuột thì sẽ thực hiện Download file từ URL về Ô Đĩa cứng của mình . Vidu : từ http://diachi/list.txt đến d:/thumuc/setting/list.txt . Ai viết dùm em COde mẫu với . Thank trước
TungZiMa
26/04/2013 21:29
Danh sách câu trả lời (1)

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
Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long
Private Const S_OK As Long = &H0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
.....
Dim lngFile As Long
Dim strSourceURL As String
3.
Dim strLocalFile As String
4.
Dim strUpdateInformation() As String
Dim strMessage As String
strSourceURL = "http://www.yourlinkhere.com/NameOfDownloadFile.zip"
strLocalFile = App.Path & "\NameOfDownloadFile.zip"
Call DeleteUrlCacheEntry(strSourceURL) 'In case you had a cached copy of file, this deletes the cached file
If URLDownloadToFile(0&, strSourceURL, strLocalFile, BINDF_GETNEWESTVERSION, 0&) = S_OK Then
'File was downloaded correctlty
Else
'There was an error
End If
Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long
Private Const S_OK As Long = &H0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
.....
Dim lngFile As Long
Dim strSourceURL As String
3.
Dim strLocalFile As String
4.
Dim strUpdateInformation() As String
Dim strMessage As String
strSourceURL = "http://www.yourlinkhere.com/NameOfDownloadFile.zip"
strLocalFile = App.Path & "\NameOfDownloadFile.zip"
Call DeleteUrlCacheEntry(strSourceURL) 'In case you had a cached copy of file, this deletes the cached file
If URLDownloadToFile(0&, strSourceURL, strLocalFile, BINDF_GETNEWESTVERSION, 0&) = S_OK Then
'File was downloaded correctlty
Else
'There was an error
End If
Trả lời câu hỏi
Câu hỏi lĩnh vực Lập trình
Rao vặt Siêu Vip