Runtime error '5' invalid procedure call or argument

Tengo el siguiente código el cual tiene la función de traer la hora desde una pagina de internet, realizado en visual basic 6.0, el problema que tengo es que después de un rato de estar funcionando me genera un runtime error '5' invalid procedura call or argument, he estado haciendo pruebas y aun no doy con el error, si alguien me pudiera ayudar.

De antemano Gracias!

Private Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Const scUserAgent = "VB Project"
Private Const INTERNET_FLAG_RELOAD = &H80000000
Private Declare Function InternetOpen Lib "wininet.dll" 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 InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hOpen As Long, ByVal sUrl As String, ByVal sHeaders As String, ByVal lLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Public hora_local As String
Private Sub Form_Load()
SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, SWP_FLAGS
End Sub
Private Sub Timer1_Timer()
Dim hInternet As Long
Dim hHttp As Long
Dim bRet As Boolean
Dim sBuff As String * 2048
Dim lNumberOfBytesRead As Long
Dim sBuffer, hora As String
hInternet = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, vbNullString, 0)
If hInternet = 0 Then Debug.Assert (0)
hHttp = InternetOpenUrl(hInternet, "http://tycho.usno.navy.mil/cgi-bin/timer.pl", vbNullString, 0, _
INTERNET_FLAG_RELOAD, 0)
DoEvents
If hHttp = 0 Then MsgBox "No hay conexión a Internet." & Chr(13) & Chr(13) & "Hora no actualizada.", vbExclamation, "Problema de conexión": Exit Sub
sBuff = vbNullString
bRet = InternetReadFile(hHttp, sBuff, Len(sBuff), lNumberOfBytesRead)
sBuffer = sBuffer & Left$(sBuff, lNumberOfBytesRead)
tiempo = Format(Int(Hour(Now)) Mod 24, "00") & ":" & _
Format(Int(Minute(Now)) Mod 60, "00")
If tiempo < "11:58:45" Then
hora_local = Mid(sBuffer, InStr(1, sBuffer, "AM PDT") - 18, 17)
Else
hora_local = Mid(sBuffer, InStr(1, sBuffer, "PM PDT") - 18, 17)
End If
hora = Mid(hora_local, 10)
If tiempo < "11:58:45" Then
Label1.Caption = Format$(hora, "h:nn") & "A"
Else
Label1.Caption = Format$(hora, "h:nn") & "P"
End If
End Sub

Añade tu respuesta

Haz clic para o