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. C / C++ / MFC
  4. CHtmlView Question

CHtmlView Question

Scheduled Pinned Locked Moved C / C++ / MFC
questionhtmlhelp
4 Posts 2 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.
  • A Offline
    A Offline
    Abhishek Narula
    wrote on last edited by
    #1

    Hello Everyone, I am creating a basic WebBrowser type of application. One of our requirement is to allow drag-drop of images (placed in a layer) withing the HTML page. To intercept the dragging events , I overrided OnGetDropTarget() and provided my own CCustromDropTarget (derived from IDropTarget) class's object. Doing so, i am able to receive all the dragging events occuring while user is dragging image/text etc in the view. However I am stuck with the following : 1) When the content dragged is an Image (CF_DIB), How do I extract HBITMAP from the IDataObject passed to DragEnter() 2) Although the content dragged is an image, but thats the represantation of a particular type of object used in our application. hence when the image is dragged I want to transfer some more data in this IDataObject than just the image. Lets say I want to pass actual IHTMLElement which is being dragged. How Do I achieve that ? My best guess for the 2nd question was to handle FilterDataObject() and provide a new IDataObject which has the extra information required in our application. Unfortunately this function is never getting called. Can someone please throw light on FilterDataObject() as well. Best Regards, Abhishek Narula Abhishek Narula

    S 1 Reply Last reply
    0
    • A Abhishek Narula

      Hello Everyone, I am creating a basic WebBrowser type of application. One of our requirement is to allow drag-drop of images (placed in a layer) withing the HTML page. To intercept the dragging events , I overrided OnGetDropTarget() and provided my own CCustromDropTarget (derived from IDropTarget) class's object. Doing so, i am able to receive all the dragging events occuring while user is dragging image/text etc in the view. However I am stuck with the following : 1) When the content dragged is an Image (CF_DIB), How do I extract HBITMAP from the IDataObject passed to DragEnter() 2) Although the content dragged is an image, but thats the represantation of a particular type of object used in our application. hence when the image is dragged I want to transfer some more data in this IDataObject than just the image. Lets say I want to pass actual IHTMLElement which is being dragged. How Do I achieve that ? My best guess for the 2nd question was to handle FilterDataObject() and provide a new IDataObject which has the extra information required in our application. Unfortunately this function is never getting called. Can someone please throw light on FilterDataObject() as well. Best Regards, Abhishek Narula Abhishek Narula

      S Offline
      S Offline
      Sheng Jiang
      wrote on last edited by
      #2

      HRESULT CHtmlCtrl::OnFilterDataObject(IDataObject * pDataObject, IDataObject ** ppDataObject)//filter all except CF_TEXT { COleDataObject OleDataObject; OleDataObject.Attach(pDataObject,FALSE); COleDataSource* pOleDataSource=new COleDataSource; if(OleDataObject.IsDataAvailable(CF_TEXT)){ // Get text data from ColeDataObject. HGLOBAL hGlobal=OleDataObject.GetGlobalData(CF_TEXT); pOleDataSource->CacheGlobalData(CF_TEXT,hGlobal); } REFIID riid=IID_IDataObject; pOleDataSource->ExternalQueryInterface(&riid,(LPVOID*)ppDataObject); OleDataObject.Detach(); return S_OK; } You may get more information if you find the clipboard containes data in CF_HTML or CF_DIB format. http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng Command what is yours Conquer what is not ---Kane

      A 1 Reply Last reply
      0
      • S Sheng Jiang

        HRESULT CHtmlCtrl::OnFilterDataObject(IDataObject * pDataObject, IDataObject ** ppDataObject)//filter all except CF_TEXT { COleDataObject OleDataObject; OleDataObject.Attach(pDataObject,FALSE); COleDataSource* pOleDataSource=new COleDataSource; if(OleDataObject.IsDataAvailable(CF_TEXT)){ // Get text data from ColeDataObject. HGLOBAL hGlobal=OleDataObject.GetGlobalData(CF_TEXT); pOleDataSource->CacheGlobalData(CF_TEXT,hGlobal); } REFIID riid=IID_IDataObject; pOleDataSource->ExternalQueryInterface(&riid,(LPVOID*)ppDataObject); OleDataObject.Detach(); return S_OK; } You may get more information if you find the clipboard containes data in CF_HTML or CF_DIB format. http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng Command what is yours Conquer what is not ---Kane

        A Offline
        A Offline
        Abhishek Narula
        wrote on last edited by
        #3

        First of all, thank you very much for replying to the post. Let me re-iterate on the question, In the Very first place, OnFilterDataObject is not getting called. (btw I am using CHTMLView) Moreover the contents are in CF_DIB format (this i extracted from IDataObject passed in OnDragEnter()) Now my question is how to construct HBITMAP from the data available in CF_DIB format. Thanks again, Abhishek Narula

        S 1 Reply Last reply
        0
        • A Abhishek Narula

          First of all, thank you very much for replying to the post. Let me re-iterate on the question, In the Very first place, OnFilterDataObject is not getting called. (btw I am using CHTMLView) Moreover the contents are in CF_DIB format (this i extracted from IDataObject passed in OnDragEnter()) Now my question is how to construct HBITMAP from the data available in CF_DIB format. Thanks again, Abhishek Narula

          S Offline
          S Offline
          Sheng Jiang
          wrote on last edited by
          #4

          sorry, FilterDataObject seems only works for copy/paste try this to prevent the DHTML DOM from handling drag events: also check if other elements handle these events in scripts. you can either modify these attributes through source code or through DHTML DOM. you also can override CView::OnDrop to handle dropped data, or CHTMLView::OnGetDropTarget to change the drag/drop behavairs. for more information about DIB and DDB, check the "copy/paste an image" section of [^] http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng Command what is yours Conquer what is not ---Kane

          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