none
BITS Resume method gives BG_E_EMPTY RRS feed

  • Question

  • Hi,
     
    I am trying to create an application that will use BITS protocol to download a set of files..
    Right now, my code is ok till adding the file set via AddFileSet() method..

    As per the documentation, I need to call Resume method to start the download..
    here, I'm getting the return value as BG_E_EMPTY, means no files to transfer, according to the documentation..
    Not sure what's wrong here..I'm attaching the code below..Please let me know what's wrong I'm doing here..

    It download if I give a single file to download..

    Thanks,
    NKH

    #include "WinInet.h" // for INTERNET_MAX_URL_LENGTH

    WCHAR source[3][INTERNET_MAX_URL_LENGTH] = {
        L"http://testserver:2034/version.bat",
        L"http://testserver:2034/version1.bat",
        L"http://testserver:2034/version2.bat" };

    WCHAR dest[3][MAX_PATH] = {
        L"D:\\Test\\version.bat",
        L"D:\\Test\\version1.bat",
        L"D:\\Test\\version2.bat"
    };
    BG_FILE_INFO fileInfo[3] = { 0 };
    for(size_t i = 0; i < ARRAYSIZE(fileInfo); ++i)
    {
        fileInfo[i].RemoteName = source[i];
        fileInfo[i].LocalName = dest[i];
    }
    pJob->AddFileSet(ARRAYSIZE(fileInfo), fileInfo);
    HRESULT hr = pJob->Resume();
    if(FAILED(hr))
    {
        if(hr == BG_E_EMPTY)
            cout<<"No files to transfer"<<endl;
        else if(hr == BG_E_INVALID_STATE)
            cout<<"Invalid job styate"<<endl;
    }
    else if(SUCCEEDED(hr))
        sprintf(messageBuf, "\tJob Resumed\n", "BITSGet");

    Thursday, August 21, 2008 8:51 AM

Answers

All replies