Page 1 of 1

download a file

PostPosted: Tue May 27, 2014 11:43 am
by Silvio.Falconi
How I can download a file txt from a site ?
is there a small sample please ?

Re: download a file

PostPosted: Tue May 27, 2014 12:48 pm
by karinha

Re: download a file

PostPosted: Tue May 27, 2014 4:06 pm
by driessen
I use this code :
Code: Select all  Expand view
MsgRun("Downloading ...","A moment please ...",{||IF(URLDownloadToFile(0,"http://www.maconsult.be/download/report.txt.txt","C:\report.txt",0,0 ) == 0,UpdDown:=.T.,UpdDown:=.F.)})


It works very well.

Good luck.

Re: download a file

PostPosted: Wed May 28, 2014 7:08 am
by Silvio.Falconi
Error: Unresolved external '_HB_FUN_URLDOWNLOADTOFILE' referenced from ...

Re: download a file

PostPosted: Wed May 28, 2014 8:59 am
by Marc Vanzegbroeck
You have to add this to your prg.
Code: Select all  Expand view
DLL Function URLDownloadToFile(pCaller AS LONG, szURL AS STRING, szFileName AS STRING, dwReserved AS LONG, lpfnCB AS LONG) AS LONG PASCAL FROM "URLDownloadToFileA" LIB hLib

Re: download a file

PostPosted: Wed May 28, 2014 10:02 am
by Silvio.Falconi
Error description: Error BASE/1003 Variable does not exist: HLIB

Re: download a file

PostPosted: Wed May 28, 2014 10:12 am
by Marc Vanzegbroeck
You have to load lib before calling URLDownloadToFile

Code: Select all  Expand view
hLib = LOADLIBRARY( "urlmon.dll")

Re: download a file

PostPosted: Fri May 30, 2014 9:57 am
by Silvio.Falconi
but not run also I cannot download a txt file