在程序中下载指定文件,如http://www.abc.com/xyz.zip

hy7soft 2001-10-04 09:18:00
...全文
458 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
hy7soft 2001-10-19
  • 打赏
  • 举报
回复
gz
hy7soft 2001-10-14
  • 打赏
  • 举报
回复
up
hy7soft 2001-10-08
  • 打赏
  • 举报
回复
我的意思是还有什么办法
谢谢
光明山人 2001-10-08
  • 打赏
  • 举报
回复
sundayboys的办法应该可以吧?
hy7soft 2001-10-06
  • 打赏
  • 举报
回复
up
hy7soft 2001-10-06
  • 打赏
  • 举报
回复
gz
光明山人 2001-10-04
  • 打赏
  • 举报
回复
请教sundayboys: URLMon, UrlDownloadToFile是Delphi自带的吗?
line 2001-10-04
  • 打赏
  • 举报
回复
加个button,click事件上为:
ShellExecute(handle, ′open′, ′http://http://www.abc.com/xyz.zip
′, nil, nil, SW—SHOWNORMAL);
sundayboys 2001-10-04
  • 打赏
  • 举报
回复
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.abc.com/xyz.zip';
// Where to save the file
DestFile = 'c:\temp\xyz.zip';
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
else
ShowMessage('Error while downloading ' + SourceFile)
end;
VSaber 2001-10-04
  • 打赏
  • 举报
回复
你用shellexecute试试,我现在没发测试,应该可以的把!
hy7soft 2001-10-04
  • 打赏
  • 举报
回复
anything else?
光明山人 2001-10-04
  • 打赏
  • 举报
回复
我明白了,是API (Internet Client SDK),谢谢
sundayboys 2001-10-04
  • 打赏
  • 举报
回复
是,\lib下是dcu文件,\source\rtl\win下是pas文件。

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧