Difference between revisions of "URLDownloadToFile"

From wiki.visual-prolog.com

(copied from forum (updated))
m (categorized)
Line 20: Line 20:
'''urlmon.lib''' is part of the [[wikipedia:Microsoft Windows SDK]].
'''urlmon.lib''' is part of the [[wikipedia:Microsoft Windows SDK]].

Revision as of 23:42, 19 January 2008

For downloading, there is a Windows API called URLDownloadToFile which can do the job. This API needs urlmon.dll which is present in all Windows.

In your program, add the lines:

class predicates
  urlDownloadToFile : (unsigned,string URL,string File,unsigned32 Reserved,unsigned Callback) -> unsigned32 Hresult
        language apicall as "URLDownloadToFile".
   urlDownloadToFile externally   % This needs urlmon.lib
class predicates
    doDownload : (string SourceURL, string Destfile).
  doDownload(SourceURL, Destfile) :-
        Hresult = uRLDownloadToFile(0,SourceURL,Destfile,0,0),
        common_exception::checkNoApiException(classInfo, Hresult, "URLDownloadToFile",
            [namedValue("SourceURL", string(SourceURL)), namedValue("Destfile", string(Destfile))]).

You will alo need to add urlmon.lib to your project, because URLDownloadToFile is not in the Visual Prolog libs.

urlmon.lib is part of the wikipedia:Microsoft Windows SDK.