bestlong 怕失憶論壇

標題: 用 URL 下載檔案 [打印本頁]

作者: bestlong    時間: 2006-5-20 14:59     標題: 用 URL 下載檔案

在 uese 宣告 URLMon
然後加入下列函數
  1. function DownloadFile(Source, Dest: string): Boolean;
  2. begin
  3.   try
  4.     Result :=  UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
  5.   except
  6.     Result := False;
  7.   end;
  8. end;

  9. // Example:
  10. procedure TForm1.Button1Click(Sender: TObject);
  11. begin
  12.   if DownloadFile  ('http://www.delphi3000.com/index.htm, 'c:\index.htm') then
  13.    ShowMessage('Download successful')
  14.   else
  15.    ShowMessage('Download unsuccessful')
  16. end;
複製代碼





歡迎光臨 bestlong 怕失憶論壇 (http://www.bestlong.idv.tw/) Powered by Discuz! X1.5