۰۶-شهریور-۱۳۹۲, ۱۶:۳۵:۳۰
توجه: در خط آخر به جای عبارت URL باید لینک فایل و به جای عبارت PATH باید مسیر ذخیره فایل را بدهید
مثال:
مثال:
کد php:
DownloadFile "http://iranled.com/pic.jpg", "c:\mypic.jpg"
کد:
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 Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Public Function DownloadFile(sSourceUrl As String, sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, sSourceUrl, sLocalFile, BINDF_GETNEWESTVERSION, 0&) = ERROR_SUCCESS
End Function
Private Sub Command1_Click()
DownloadFile "URL", "PATH"
End Sub