URLDownloadToFile Error(0x80004004) in IDownloadManager::Download

2

I made custom downloader of IE using IDownloader Interface and URLDownloadToFile method. But URLDownloadToFile return 0x80004004 error code. I wonder! what's wrong in source code?

reference : http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/3fbcea06-4e69-4504-82e0-f4786368a5e2

STDMETHODIMP CDownloader::Download(IMoniker* pmk,  
        IBindCtx* pbc,  
        DWORD dwBindVerb,  
        LONG grfBINDF,  
        BINDINFO* pBindInfo,  
        LPCOLESTR pszHeaders,  
        LPCOLESTR pszRedir,  
        UINT uiCP )  
{ 
    LPOLESTR sDisplayName; 
    pmk->GetDisplayName(NULL, NULL, &sDisplayName);
    HRESULT hr = URLDownloadToFile(NULL, sDisplayName, L"C:\\downloaded.exe", 0, NULL);
    return S_OK;
}
c++
wininet
asked on Stack Overflow Jan 2, 2012 by user1117330

2 Answers

2

This is an error code for E_ABORT, so it looks like your download operation was aborted

From MSDN:

"The download operation can be canceled by returning E_ABORT from any callback"

but since your callback is NULL, it is probably caused by some other problem.

answered on Stack Overflow Jan 2, 2012 by marcinj
2

I solved it.

COM object on Internet explorer must create file in IE template folder. Because IE protected mode.

answered on Stack Overflow Jan 18, 2012 by user1117330

User contributions licensed under CC BY-SA 3.0