Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error
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 a开发者_运维问答re 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.
After reimplementing about half of IDataObject, it turns out that error code is caused by not supporting "Shell IDList Array" in GetDataPresent().
精彩评论