A
Adnil
Unregistered / Unconfirmed
GUEST, unregistred user!
该函数使用非常方便,不过没有用线程方式执行,而且下载进度无法得知(下载一个大文件的时候),我们总想显示下载进度,请问各位大虾有什么解决方案吗?
附上一些代码
原型:
function URLDownloadToFile(Caller: IUnknown; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IBindStatusCallback): HResult; stdcall;
StatusCB如何使用?
示例:
uses URLMon;
function DownloadFile(Source: string; Dest: TFileName): boolean;
begin
try
Result := UrlDownloadToFile(nil, Pchar(Source), Pchar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
附上一些代码
原型:
function URLDownloadToFile(Caller: IUnknown; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IBindStatusCallback): HResult; stdcall;
StatusCB如何使用?
示例:
uses URLMon;
function DownloadFile(Source: string; Dest: TFileName): boolean;
begin
try
Result := UrlDownloadToFile(nil, Pchar(Source), Pchar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;