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

I am trying to use this great example to implement deleting virtual files in Windows Explorer. However, I was mistaken in this error. At 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 ((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); I am returning a DV_E_FORMATETC error. As far as I can tell, all the elements of the FORMATETC structure that are passed are valid: cfFormat is "Shell IDList Array" (-16141), ptd is 0, dwAspect is DVASPECT_CONTENT, lindex is -1, and tymed is TYMED_HGLOBAL. I was kind of confused, as if in any case there was a problem, since it was created by the conductor.

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

+1
c # drag-and-drop com windows-explorer
source share
1 answer

After overriding about half of IDataObject, it turns out that the error code is caused by the fact that it does not support the "Shell IDList Array" in GetDataPresent ().

+3
source share

All Articles