CHtmlView Question
-
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
-
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
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
-
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
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
-
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
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