【问题标题】:Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error拖放到资源管理器导致无效 FORMATETC (DV_E_FORMATETC) 错误
【发布时间】:2010-05-27 01:47:14
【问题描述】:

我正在尝试使用this excellent example 来实现将虚拟文件拖放到 Windows 资源管理器中。但是,我被这个错误所困扰。在第一次调用((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); 时,在void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) 内部,我返回了DV_E_FORMATETC 错误。据我所知,传入的 FORMATETC 结构的所有元素都是有效的:cfFormat 是“Shell IDList Array”(-16141),ptd 是 0,dwAspect 是 DVASPECT_CONTENT,lindex 是 -1,tymed 是TYMED_HGLOBAL。我有点困惑怎么会有问题,因为这是由资源管理器生成的。

我对 COM 交互知之甚少,因此我们将不胜感激。

【问题讨论】:

    标签: c# com drag-and-drop windows-explorer


    【解决方案1】:

    重新实现了大约一半的IDataObject后,发现错误码是由于GetDataPresent()中不支持“Shell IDList Array”引起的。

    【讨论】:

      猜你喜欢
      • 2011-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多