免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Delphi UrlDownloadToFile 實現(xiàn)文件下載
Delphi實現(xiàn)文件下載UrlDownloadToFile
UrlDownloadToFile是一個非常不錯的函數(shù),我們可以用它來下載各種格式的圖片、音樂、文件等等。
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.Button1Click(Sender: TObject);
const
// URL Location
SourceFile:='http://www.0523www.como/images/logo.gif';
// Where to save the file
DestFile := 'c:\3k2.gif';
begin
if DownloadFile(SourceFile, DestFile) then
begin
ShowMessage('下載成功!');
// Show downloaded image in your browser
ShellExecute(Application.Handle,PChar('open'),PChar(DestFile),PChar(''),nil,SW_NORMAL)
end
else
ShowMessage(SourceFile+'下載出錯!')
end;

如果涉及批量下載,那么在上例中Button1Click我們可以這樣寫:
procedure TForm1.Button1Click(Sender: TObject);
//---自己定義一個URL List和文件命名的List---//
begin
if DownloadFile(URLList, FileName) then
begin
ShowMessage('下載成功!');
ShellExecute(Application.Handle,PChar('open'),PChar('路徑'+FileName+'.exe'),PChar(''),nil,SW_NORMAL) //這句用不上,就閃掉,只做下載測試用。
end
else
ShowMessage(URLList+'下載出錯!')
end;
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Delphi從Internet下載文件
delphi 動態(tài)修改exe文件的圖標
delphi基礎(chǔ)開發(fā)技巧
DELPHI7執(zhí)行dos命令并等待完成再執(zhí)行面的語句
【轉(zhuǎn)】delphi中pointer的使用
delphi 啟動停止windows服務(wù) 轉(zhuǎn)
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服