If your program relies on Packages or DLLs than deploying new versions of your libraries certainly takes some time. The Internet now provides a fairly easy way to accomplish this task. Adding an auto-update option to your applications could be the best way to keep your Delphi applications up to date.
Let's see how to create the most important piece of code in any FTP application.
Delphi gives us full access to the WinInet API (wininet.pas) which we can use to connect to and retrieve files from any Web site that uses either Hypertext Transfer Protocol (HTTP) or File Transfer Protocol (FTP). For example, we could use the functions inside the WinInet API to: add an FTP browser to any application, create an application that automatically downloads files from a public FTP site or search the Internet site for references to graphics and download only the graphics.
Note: In order to provide some visual feedback to the user you could add a line like FlashWindow(Application.Handle,True) in the body of the repeat/until block. The FlashWindow API call flashes the caption of your applications name in the task bar.
Usage To call the GetInetFile function you could use the next peace of code:
var FileOnNet, LocalFileName: stringbegin
FileOnNet:=
'http://delphi.about.com/library/forminbpl.zip';
LocalFileName:='File Downloaded From the Net.zip'
if GetInetFile(FileOnNet,LocalFileName)=True then
ShowMessage('Download successful')
else
ShowMessage('Error in file download')
end;
This code will get the 'forminbpl.zip' file from this site, download it, and save it as 'File Downloaded From the Net.zip'.
Note: Depending on which version of Delphi you have, several components can be found on the Internet page of the VCL palette that are designed to ease the task of Internet enabling your applications. For an example of a FTP component look for TNMFTP in the FastNet VCL page. <!-- END ARTICLE CONTENT -->
Get File From the Net Create a Delphi application that downloads files from the Internet; add an auto-update feature to your programs. &lt;!-- BEGIN FREQUENCY TEMPLATE --&gt;&l...