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
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