The author needs to write a function of downloading files in the system that the author recently developed. I used to call the API before using BCB. I suddenly remembered that there was an API to get it, so I came to search early. This API is URLDOWNLOADTOFILE. Not only that, some controls of Delphi can also be easily downloaded, such as nmhttp, specify nmhttp1.inputfilemode: = TURE; specifying Body as a local file name, specifying Get can be downloaded. Here are the detailed code, all from 9cbs. I all sort it here so that everyone is convenient.
================= = Urlmon; Function Downloadfile: Boolean; Begin Try Result: = URLDOWNLOADTOFILE (NIL, PCHAR (SOURCE), PCHAR (DEST) , 0, NIL) = 0; EXCEPT RESULT: = false; end; end; if Downloadfile ('http://www.borland.com/delphi6.zip,' c: / kylix.zip ') Then ShowMessage (' Download Succesful ') Else ShowMessage (' Download unsuccesful ') ================================= routine: Uses urlmon, shellapi; Function Downloadfile (Sourcefile, Destfile: String): Boolean; Begin Try Result: = URLDOWNLOADTOFILE (NIL, PCHAR (SOURCEFILE), PCHAR (DESTFILE), 0, NIL) = 0; ExcePt Result: = false; end; end; procedure tform1.button1.click (Sender: TOBJECT); const // url location sourcefile: = 'http://www.google.com/intl/de/images/home_title.gif'; // Where to save the file destfile: = 'C: / Temp / Google -image.gif '; begin if DownloadFile (SourceFile, DestFile) then begin ShowMessage (' Download succesful! '); // Show downloaded image in your browser ShellExecute (Application.Handle, PChar (' open '), PChar ( Destfile, pchar (''), nil, sw_normal) end; w d l;; ================= Add to code: NMHTTP1. InputFileMode: = ture; NMHTTP1.Body: = 'local file names'; NMHTTP1.Header: =' Head.txt '; NMHTTP1.OutputFileMode: = FALSE; NMHTTP1.ReportLevel: = Status_Basic; NMHTTP1.Proxy: =' proxy IP address '; nmhttp1.proxyport: ='