WebBrowser: IDropTarget

南楼画角 提交于 2019-12-11 02:18:40

问题


I am looking for an example how to implement IDropTarget within WebBrowser. As a 'base' code I will be using this answer.


回答1:


In theory, you should wrap the original IDropTarget object, passed from MSHTML to you at IDocHostUIHandler::GetDropTarget, and return your own implementation of IDropTarget, which would forward all IDropTarget methods to that original object, with one exception: IDropTarget::DragEnter.

In your implementation of IDropTarget::DragEnter, you would check the IDataObject object which contains the data about to be dropped (IDataObject::EnumFormatEtc) and return DROPEFFECT_NONE if the data is not acceptable, otherwise forward it too.

I don't have a ready-to-use code sample for this. Feel free to experiment and post your own answer when you get there.



来源:https://stackoverflow.com/questions/20066447/webbrowser-idroptarget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!