Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I stumbled on the below method and couldn't believe how simple it was. Download with progress indication and everything. I have made some revisions since this FAQ was first posted, thanks to machele for asking all the right questions.
This program can handle username/password and unsafe characters in the URL. An example of a fullblown URL for this program would be something like [b]sURLandFile = "ftp://username:password@domain/Some Path/Some File I Want.zip"[/b] <-- note that the path and filename have spaces in them (space is an unsafe URL character that needs to be turned into escape sequences - see HandleUnsafeChars function below)
***(Cut-n-paste the code into a prg file and run from within VFP)***
Local sURLandFile, nRet
Declare DoFileDownload IN shdocvw.dll STRING lpszFile
sURLandFile = "ftp://ftp.microsoft.com/deskapps/readme.txt";
sURLandFile = HandleUnsafeChars(sURLandFile)
IF !EMPTY(sURLandFile)
nRet=DoFileDownload(STRCONV(sURLandFile,5))
ELSE
MESSAGEBOX("Function returned an empty length string.",16,"Something is Wrong")
ENDIF
************************
FUNCTION HandleUnsafeChars(sAddressUrl)
***Purpose: Change unsafe chars to escape sequences
************************
#DEFINE ICU_BROWSER_MODE 33554432 && 0x2000000
DECLARE INTEGER InternetCanonicalizeUrl IN wininet;
STRING sURL, STRING @sBUFFER, INTEGER @nLength, INTEGER nFlags
LOCAL sNewUrl, nResult
nResult = 250
sNewUrl = Replicate(Chr(0), nResult)
IF InternetCanonicalizeUrl (sAddressUrl,@sNewUrl, @nResult, ICU_BROWSER_MODE) <> 0
RETURN Left(sNewUrl, nResult)
ELSE
RETURN ""
ENDIF
ENDFUNC &&HandleUnsafeChars