Results 1 to 12 of 12

Thread: Downloading - help!

  1. #1

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Unhappy

    I use this API to download files:

    Code:
    Public Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
    (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
    ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    The problem is I want to use a progress bar and I have no idea how to make that Any help appreciated!

  2. #2

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    -> Top

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Fox, I did ask for this before and yet no reply so far

  4. #4
    Guest
    I emailed a anti-virus program company called Protector Plus and asked them how to do it, because they use the urlmon.dll and it shows the progress, how much is complete, how much time is remaining, etc.

    They emailed back, and didn't seem to know how to do it .
    To me, they were playing dumb, but they probably just didn't want to tell me .

  5. #5

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    so I'll try to figure it out..

    I'll post here when done

  6. #6
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    it's done using a callback interface (Says MSDN). I don't think it's possible in VB, becuase i don't think you can create a Callback Interface. Maybe it's possible, but i don't think so
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  7. #7

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    If it's impossible that would explain why I didnt' know how to do it in VB (since I know how to do it in C) but I think there must be a way

  8. #8
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    fox, how are you using the call?
    i.e. what are you using as parameter 1?
    buzzwords are the language of fools

  9. #9
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Try using hooks and seeing if you can get any extra info that way (eg. bytes done) and if you know how many bytes there are at the start then you are on your way!
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  10. #10
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    its not that simple sastraxi - look up the function in MSDN:

    HRESULT URLDownloadToFile(
    LPUNKNOWN pCaller,
    LPCSTR szURL,
    LPCSTR szFileName,
    DWORD dwReserved,
    LPBINDSTATUSCALLBACK lpfnCB
    );

    the last param is apparently:

    Address of the caller's IBindStatusCallback interface. URLDownloadToFile calls this interface's IBindStatusCallback::OnProgress method on a connection activity, including the arrival of data. IBindStatusCallback::OnDataAvailable is never called. Implementing IBindStatusCallback::OnProgress allows a caller to implement a user interface or other progress monitoring functionality. It also allows the download operation to be canceled by returning E_ABORT from the IBindStatusCallback::OnProgress call. Can be NULL

    So..i'd guess you'd need a class that implements this interface; thats in MSDN too. then you'd pass a pointer to an instance of that class?

    Dim BindStatCB as new IBindStatusCallback

    i.e. ObjPtr(BindStatCB)

    If you can find a TLB/DLL that has IBindStatusCallback in it, then you don't have to write the class yourself.

    NOTE: this probably won't work
    buzzwords are the language of fools

  11. #11
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I think Fox you are already doing this, but can't you make a Dll/ocx in C/C++ which monitors the download (and which has a visible component ) and use it in your application. If you are doing this or are planning to do this, could you send me the dll/ocx also(I am not hat comfortabl with C)

  12. #12
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611
    Looking for a friendly intelligent chat forum? Visit the white-hart.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width