Results 1 to 5 of 5

Thread: URLDownloadToFile

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    URLDownloadToFile

    Every time I use URLDownloadToFile my program freezes until the transfer is done...I want it to just download, and let the user still do things...

    and one other thiing, using URLDownloadToFile how can I get the percent finished?

    Thanks

  2. #2
    Zaei
    Guest
    You could probably thread URLDownloadToFile(). The last parameter of that function is a function pointer that you can specify download status.

    Z.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    good idea....thanks

    Im not sure how to use that last parameter though

  4. #4
    Zaei
    Guest
    I looked at that post, and realized that the second part made no sense =).

    Also, its not a function pointer, as I first thought. Its an Object, that inherits from IBindStatusCallback. Simply implement the OnProgress member function. There is lots of info in the MSDN.

    Z.

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    How about using API...

    PHP Code:
        HINTERNET    hInet=NULL;
        
    HANDLE        hFile=NULL;
        
    DWORD        dwByteDownload=0;
        
    char        Buff[10240];

        
    // Open a new instance of the Internet Access
        
    hInet InternetOpen("MyXML"INTERNET_OPEN_TYPE_DIRECTNULLNULL0);
        if (
    hInet != NULL)
        {
            
    // Access the given URL
            
    hFile InternetOpenUrl(hInet"http://www.yahoo.com"NULL0INTERNET_FLAG_RELOAD0);
            if (
    hFile != NULL)
            {
                
    memset(Buff'\0'10240);
                
    InternetReadFile(hFile, &BuffSz, &dwByteDownload);
            }
        }
        
        
    // Close all the used handle
        
    InternetCloseHandle(hInet);
        
    InternetCloseHandle(hFile); 
    regards,

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