Implementing IDownloadManager & download() method..
-
Hi, I want to create an IE plug-in where whenever a download dialog is expected, the file is downloaded automatically to a specified folder - the dialog should should not appear. Has anyone worked on something similar? Is such a thing work be possible to do w/out extensive COM/IE/ATL/OLE knowledge? I am somewhat familiar with C++ & COM/ATL/OLE concepts. From the MSDN docs, I also know that I just need to create a COM object which implements a couple of interfaces and register it. But, am absolutely clueless where to begin & how to get to that. (Never used the Visual Studio) Any helpful pointers plz ? Thanks, -pk
-
Hi, I want to create an IE plug-in where whenever a download dialog is expected, the file is downloaded automatically to a specified folder - the dialog should should not appear. Has anyone worked on something similar? Is such a thing work be possible to do w/out extensive COM/IE/ATL/OLE knowledge? I am somewhat familiar with C++ & COM/ATL/OLE concepts. From the MSDN docs, I also know that I just need to create a COM object which implements a couple of interfaces and register it. But, am absolutely clueless where to begin & how to get to that. (Never used the Visual Studio) Any helpful pointers plz ? Thanks, -pk
The IE plugin system uses COM for most things, so you'll need to learn about it. Start here: Introduction to COM - What It Is and How to Use It.[^]
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze
-
Hi, I want to create an IE plug-in where whenever a download dialog is expected, the file is downloaded automatically to a specified folder - the dialog should should not appear. Has anyone worked on something similar? Is such a thing work be possible to do w/out extensive COM/IE/ATL/OLE knowledge? I am somewhat familiar with C++ & COM/ATL/OLE concepts. From the MSDN docs, I also know that I just need to create a COM object which implements a couple of interfaces and register it. But, am absolutely clueless where to begin & how to get to that. (Never used the Visual Studio) Any helpful pointers plz ? Thanks, -pk
-
Hi, I want to create an IE plug-in where whenever a download dialog is expected, the file is downloaded automatically to a specified folder - the dialog should should not appear. Has anyone worked on something similar? Is such a thing work be possible to do w/out extensive COM/IE/ATL/OLE knowledge? I am somewhat familiar with C++ & COM/ATL/OLE concepts. From the MSDN docs, I also know that I just need to create a COM object which implements a couple of interfaces and register it. But, am absolutely clueless where to begin & how to get to that. (Never used the Visual Studio) Any helpful pointers plz ? Thanks, -pk
///////////////////////////////////////////////////////////////////////////// // CestDLHandler CestDLHandler::CestDLHandler() { m_lUid = 0; } STDMETHODIMP CestDLHandler::Download(IMoniker* pmk, IBindCtx* pbc, DWORD dwBindVerb, LONG grfBINDF, BINDINFO* pBindInfo, LPCOLESTR pszHeaders, LPCOLESTR pszRedir, UINT uiCP ) { traceFerruccio(_T("IMoniker %p CestDLHandler %p \n"),pmk, this); HRESULT hr; //Stream will be released in the BSCB OnDataArrival IStream *pstm; //Attempt to create our BindStatusCallBack WBBSCBFileDL *filedl = NULL; //Returns a NonAddRef pointer to a new BSCB //AddRef is called on this BSCB during a successfull call //to RegisterBindStatusCallback if(WBCreateBSCBFileDL(&filedl) != S_OK) { return E_FAIL; } //Init the BSCB m_lUid++; filedl->InitByUser(m_lUid, this, pszHeaders, NULL); IBindStatusCallback *pPrevBSCB = NULL; hr = RegisterBindStatusCallback(pbc, reinterpret_cast(filedl), &pPrevBSCB, 0L); /* Exception to the rule RegisterBindStatusCallback return E_FAIL Cause: Content_Disposition header returned from a server in response to a file download via a post or ,.. Example: downloading attachements from Hotmail, Yahoo, ... Unfortunately, due to no documentation regarding an E_FAIL return, and more specifically, regarding RegisterBindStatusCallback internal workings, I had to resort to using RevokeObjectParam on the previous BSCB and in my implementation of BSCB, relay certain calls to the previous BSCB to make DL work. I do not know if this is a bug or done intentionaly. */ /* KB article http://support.microsoft.com/default.aspx?scid=kb;en-us;274201 Notifies the client application that this resource contained a Content-Disposition header that indicates that this resource is an attachment. The content of this resource should not be automatically displayed. Client applications should request permission from the user. This value was added for Internet Explorer 5. */ if( (FAILED(hr)) && (pPrevBSCB) ) { //RevokeObjectParam for current BSCB, so we can register our BSCB LPOLESTR oParam = L"_BSCB_Holder_"; hr = pbc->RevokeObjectParam(oParam); if(SUCCEEDED(hr)) { //Attempt register again, should succeed n