PDA

Click to See Complete Forum and Search --> : Continued problems on internet transfers


Janitor
Jan 5th, 2000, 12:44 PM
I recently ran into a problem where my program would hang on final unloading due to an evident problem with the Microsoft Internet Control. I substituted Wininet API's instead, but I am still running into the problem. Am I forgetting to do something at the end of my program? Below is the code for the function I use everytime I pull a web page in the program:

Private Function rf_web(ls_webAddress As String) As String
Dim ll_open As Long
Dim ll_openURL As Long
Dim ls_return As String
Dim ls_tempBuffer As String * 2048
Dim ll_bytes As Long

ll_open = InternetOpen("vb wininet", INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
ll_openURL = InternetOpenUrl(ll_open, ls_webAddress, vbNullString, 0, INTERNET_FLAG_RELOAD, 0)
ls_return = ""

Do While Len("hold") > 0
ls_tempBuffer = ""
InternetReadFile ll_openURL, ls_tempBuffer, Len(ls_tempBuffer), ll_bytes
ls_return = ls_return & Left$(ls_tempBuffer, ll_bytes)

If Not CBool(ll_bytes) Then Exit Do
Loop

InternetCloseHandle ll_openURL
InternetCloseHandle ll_open
rf_web = ls_return
End Function

Mark Sreeves
Jan 5th, 2000, 05:10 PM
Can you post the APIs that you are using?

Janitor
Jan 6th, 2000, 05:16 AM
The API's I am using in the program are the following:

Public 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
Public 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
Public Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal _
lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer

Public Const INTERNET_OPEN_TYPE_DIRECT = 1
Public Const INTERNET_FLAG_RELOAD = &H80000000