ABのサンプルにWinsockを使ったものが紹介されているので、ここではwininetを使ったものでも。
wininetはとても簡単で、ファイル操作と同じ感覚で使うことができる。
InternetOpenでNetを開く、
InternetOpenUrlでurlにつなぐ
InternetReadFileで読み込む
InternetCloseHandleで終了
HttpQueryInfoはサイズやタイプ、更新日時などの情報を得る


以下サンプル

#console
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA"(lpszCallerName As BytePtr,dwAccessType As Long,_
lpszProxyName As BytePtr,lpszProxyBypass As BytePtr,dwFlags As Long) As Long
Declare Function HttpQueryInfo Lib "wininet.dll" Alias "HttpQueryInfoA"(hHttpRequest As Long,dwInfoLevel As Long,_
lpvBuffer As BytePtr,ByRef lpdwBufferLength As Long,ByRef lpdwIndex As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll"(hInternetHandle As Long) As Long
Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (hInternetSession As Long,_
sUrl As BytePtr,sHeaders As Long,lHeadersLength As Long,lFlags As Long,lContext As Long) As Long
Declare Function InternetReadFile Lib "wininet.dll" (hFile As Long, sBuffer As BytePtr,_
lNumBytesToRead As Long,lNumberOfBytesRead As Long) As Long

Const HTTP_QUERY_CONTENT_TYPE=1
Const HTTP_QUERY_CONTENT_LENGTH=5
Const HTTP_QUERY_LAST_MODIFIED=11

Dim i As String

Download("http://celeb.jpn.ph/princess/img/744.jpg", "test.jpg")
Input i


Sub Download(url As BytePtr, localfile As BytePtr)
Dim hOpen As HANDLE, hUrl As HANDLE,hFile As HANDLE
Dim buffer As BytePtr
Dim Size As Long
Dim a As Long
Dim dwReadSize As DWord, dwWriteSize As DWord
Dim TotalReadSize As DWord
Print "接続待ち -> ";MakeStr(url)
Size = 33333
buffer=calloc(Size)
hOpen=InternetOpen(0,0,0,0,0)
hUrl=InternetOpenUrl(hOpen,url,0,0,0,0)
HttpQueryInfo(url,HTTP_QUERY_CONTENT_LENGTH,buffer,Size,a)
Print "ファイルサイズ -> " ; MakeStr(buffer)
hFile = CreateFile(localfile, GENERIC_WRITE, 0, ByVal NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0)
If hFile = INVALID_HANDLE_VALUE Then
Print "CreateFile失敗"
Goto *goot
End If
Print "DL開始"
Do
InternetReadFile(hUrl, buffer, Size, VarPtr(dwReadSize))
WriteFile(hFile, buffer, dwReadSize,VarPtr(dwWriteSize), ByVal NULL)
If dwReadSize <> dwWriteSize Then Print "書き込みエラー?"
TotalReadSize += dwReadSize
Print TotalReadSize;"Byte"
Loop While (dwReadSize)
Print "完了"
*goot
CloseHandle(hFile)
InternetCloseHandle(hUrl)
InternetCloseHandle(hOpen)
free(buffer)
End Sub