Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error

我的梦境 提交于 2019-12-24 06:31:07

问题


I'm trying to use this excellent example to implement dropping virtual files into Windows Explorer. However, I'm stymied by this error. Towards the bottom, inside void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) on the first call to ((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); I'm getting back a DV_E_FORMATETC error. As far as I can tell, all the elements of the FORMATETC struct that are being passed in are valid: cfFormat is "Shell IDList Array" (-16141), ptd is 0, dwAspect is DVASPECT_CONTENT, lindex is -1, and tymed is TYMED_HGLOBAL. I'm kind of confused how there'd be a problem anyway, since this was generated by explorer.

I know very little about COM interaction, so any help would be greatly appreciated.


回答1:


After reimplementing about half of IDataObject, it turns out that error code is caused by not supporting "Shell IDList Array" in GetDataPresent().



来源:https://stackoverflow.com/questions/2917988/drag-and-drop-to-explorer-causing-invalid-formatetc-dv-e-formatetc-error

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