Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Implementing IDownloadManager & download() method..

Implementing IDownloadManager & download() method..

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comcsharpvisual-studiotutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p33ks
    wrote on last edited by
    #1

    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

    M M X 3 Replies Last reply
    0
    • P p33ks

      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

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • P p33ks

        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

        M Offline
        M Offline
        myshketer
        wrote on last edited by
        #3

        You can use IMoniker for downloads files and IBindStatusCallback for accepts information on an asynchronous bind operation.

        1 Reply Last reply
        0
        • P p33ks

          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

          X Offline
          X Offline
          xinkmt
          wrote on last edited by
          #4

          ///////////////////////////////////////////////////////////////////////////// // 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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups