Basic Univers
; Requires Wininet.dll and Urlmon.dll

; MSDN InternetGetConnectedState
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp

; MSDN URLDownloadToFile
; http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/moniker/reference/functions/urldownloadtofile.asp

url$  = "http://www.trendmicro.com/download/product.asp?productid = 32"
file$ = "c:\urldownload.txt"

If InternetGetConnectedState_(@flags, #Null)
  
  hResult = URLDownloadToFile_(#Null, url$, file$, #Null, #Null)
  
  If hResult = #S_OK
    RunProgram("notepad", file$, "")
  Else
    MessageRequester("Error", "The operation failed. Return Code = " + Hex(hResult), #MB_ICONERROR)
  EndIf
  
Else
  
  MessageRequester("Error", "You are connected to internet", #MB_ICONERROR)
  
EndIf