
11/01/2005, 00:00
|
 | | | Fecha de Ingreso: junio-2004 Ubicación: Monterrey NL
Mensajes: 2.390
Antigüedad: 20 años, 10 meses Puntos: 53 | |
OK, Ya esta funcionando a la perfeccion...
THANKS MAN!!
el codigo quedo asi:
Código:
Const scUserAgent = "API-Guide test program"
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const sURL = "http://www.ciberstock.com/descargame.exe"
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As Long) As Integer
Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long
Private Sub Command1_Click()
Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long
Dim intCanal As Integer
intCanal = FreeFile
Open "download.exe" For Binary As #intCanal
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
hFile = InternetOpenUrl(hOpen, sURL, vbNullString, ByVal 0&, INTERNET_FLAG_RELOAD, ByVal 0&)
sBuffer = Space(2024)
Do
InternetReadFile hFile, sBuffer, 2024, Ret
If Ret > 0 Then
Put #intCanal, , sBuffer
End If
DoEvents
Loop While Ret > 0
InternetCloseHandle hFile
InternetCloseHandle hOpen
Close #intCanal
End Sub
Pongo el codigo por si a alguien le sirve!!
bytes!! |