bestlong 怕失憶論壇

 

 

搜索
bestlong 怕失憶論壇 論壇 Delphi 用 URL 下載檔案
查看: 5183|回復: 0
go

用 URL 下載檔案 [複製鏈接]

Rank: 9Rank: 9Rank: 9

1#
發表於 2006-5-20 14:59 |只看該作者 |倒序瀏覽 |打印
在 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;
複製代碼
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw
‹ 上一主題|下一主題

Archiver|怕失憶論壇

GMT+8, 2024-5-1 04:37 , Processed in 0.010017 second(s), 10 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.