Csdn Q & A: Get the download progress when using urldownloadtofile

Source: Internet
Author: User

Frmupdate = Class (tform, ibindstatuscallback)
Imgtop: timage;
Lbltop: tlabel;
Spdbtnclose: tspeedbutton;
Bevel1: tbevel;
Plstatus: tpanel;
PLINFO: tpanel;
Btncancel: tflatspeedbutton;
Tmrudapte: ttimer;
Plprogress: tpanel;
Procedure tmrudaptetimer (Sender: tobject );
Procedure btncancelclick (Sender: tobject );
Procedure formpaint (Sender: tobject );
Procedure imgtopmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer );
Procedure spdbtncloseclick (Sender: tobject );
Private
Function onstartbinding (dwreserved: DWORD; PIB: ibinding): hresult; stdcall;
Function getpriority (Out npriority): hresult; stdcall;
Function onlowresource (Reserved: DWORD): hresult; stdcall;
Function onprogress (ulprogress, ulprogressmax, ulstatuscode: ulong; szstatustext: lpcwstr): hresult; stdcall;
Function onstopbinding (hresult: hresult; szerror: lpcwstr): hresult; stdcall;
Function getbindinfo (Out grfbindf: DWORD; var bindinfo: tbindinfo): hresult; stdcall;
Function ondataavailable (grfbscf: DWORD; dwsize: DWORD; formatetc: pformatetc; stgmed: pstgmedium): hresult; stdcall;
Function onobjectavailable (const IID: tguid; punk: iunknown): hresult; stdcall;
Function gethtmlfile (URL, filename: string): hresult;
Public
{Public declarations}
End;

//------------------------------------------------------------------------------
Function tfrmupdate. gethtmlfile (URL, filename: string): hresult;
VaR
Status: ibindstatuscallback;
Begin
Status: = ibindstatuscallback (Self );
Result: = urldownloadtofile (nil, pchar (URL), pchar (filename), 0, status );
End;

//------------------------------------------------------------------------------
Function tfrmupdate. getbindinfo (Out grfbindf: DWORD;
VaR bindinfo: tbindinfo): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. getpriority (Out npriority): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. ondataavailable (grfbscf, dwsize: DWORD;
Formatetc: pformatetc; stgmed: pstgmedium): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. onlowresource (Reserved: DWORD): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. onobjectavailable (const IID: tguid;
Punk: iinterface): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. onstartbinding (dwreserved: DWORD;
PIB: ibinding): hresult;
Begin
Result: = e_notimpl;
End;

//------------------------------------------------------------------------------
Function tfrmupdate. onstopbinding (hresult: hresult;
Szerror: lpcwstr): hresult;
Begin
Result: = e_notimpl;
End;

Http://www.applevb.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.