DOWNLOAD will connect to the Internet and download a file from a specified URL to a specified path\filename.
Syntax:RetVal = DOWNLOAD(Url AS STRING, LocalFileName AS STRING) Return Value:
Parameters: |
GETHTTPFILESIZE will get the size of a file from a specified URL.
Syntax:RetVal = GETHTTPFILESIZE(Url AS STRING) Return Value:
Parameters:
|
DOWNLOADTOSTR will connect to the Internet and download a file to a specified string.
Syntax:SaveString = DOWNLOADTOSTR(Url AS STRING) Return Value:
Parameters:
|
MACRO WarAndPeace = "https://www.gutenberg.org/cache/epub/2600/pg2600.txt" DIM RemoteFileSize AS ULONG RemoteFileSize = GETHTTPFILESIZE(WarAndPeace) ' Obtain the file size IF RemoteFileSize THEN DIM TheBook$ * RemoteFileSize ' Create a large string PRINT "Size of 'War and Peace' on server = ", USING$("#", RemoteFileSize), " bytes" ' ~3.3MB File PRINT "Downloading into string variable now ... please wait ..." TheBook$ = DOWNLOADTOSTR(WarAndPeace) ' Download into our string variable BCX_MDIALOG(Example, "'War And Peace'", NULL, 0, 0, 300, 300, 0, 0, "Arial", 12) ' Read it! END ELSE PRINT "WarAndPeace URL was not found." ' Hopefully this won't happen PAUSE END END IF BEGIN MODAL DIALOG AS Example SELECT CASE CBMSG '****************** CASE WM_INITDIALOG '****************** STATIC hRichEdit AS HWND hRichEdit = BCX_RICHEDIT(0, CBHWND, 12345, 10, 10, 280, 280) SETWINDOWRTFTEXT(hRichEdit, TheBook$) CENTER(CBHWND) FUNCTION = TRUE '****************** CASE WM_QUIT, WM_CLOSE, WM_DESTROY CLOSEDIALOG END END SELECT END DIALOG