Ahhh! I see what you are saying... it's interesting because I guess I 'used up' all my sessions but there must be a ton of sessions given to a program because I went through like 2000 downloads before it happened! Are hSessions allocated per program instance... because if you started another instance of my download prog it would work.

I have posted my new code below, tell me how it looks/if you would change anything. I noticed this code floating around this message board and that's how I got it but I guess it's wrong so hopefully this will help some other people out too :-).

VB Code:
  1. Public mySession As Long
  2.  
  3. Public Function openInternetSession()
  4. ' This function opens the internet session when the program starts (instead of everytime)
  5. ' remember to close the session or you will get runaways!
  6.     Dim hSession As Long
  7.     hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
  8.     If Err.LastDllError <> 0 Then
  9.         MsgBox "Download Module: GetURLSource, error opening internet session" & vbCrLf & vbCrLf & "Error:" & vbCrLf & GetLastError
  10.     End If
  11.    
  12.     If hSession Then
  13.         mySession = hSession ' now we will use the global variable 'mySession' to access this internet session
  14.     Else
  15.         MsgBox "Error: Couldn't open internet session!"
  16.     End If
  17. End Function
  18.  
  19. Public Function closeInternetSession()
  20. ' Close the internet session
  21.     Dim iResult As Integer
  22.     iResult = InternetCloseHandle(mySession)
  23. End Function
  24.  
  25. Public Function GetURLSource(sURL As String)
  26. On Error GoTo ErrorHandler
  27.  
  28.     Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String
  29.     Dim hInternet As Long, lReturn As Long
  30.  
  31.     hInternet = InternetOpenUrl(mySession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
  32.  
  33.     If hInternet Then
  34.         iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
  35.         sData = sBuffer
  36.         Do While lReturn <> 0
  37.             iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
  38.             sData = sData + Mid(sBuffer, 1, lReturn)
  39.         Loop
  40.     End If
  41.    
  42.     iResult = InternetCloseHandle(hInternet)
  43.     GetURLSource = sData
  44.    
  45. Exit Function
  46. ErrorHandler:
  47. MsgBox "Sub/Function: GetURLSource" & vbCrLf & vbCrLf & "Encountered error #" & Err.Number & vbCrLf & Err.Description
  48. Resume Next
  49. End Function

That look about right?

Thanks a lot franz!