使用 COM 将虚拟文件从 .net 复制到 Explorer
Using COM to copy virtual files to Explorer from .net
我正在尝试在 VB.NET 中使用 IStream 将虚拟文件复制到 Windows 资源管理器,使用包装器 class 将调用链接到我自己的 IO.Stream 实现。
我正在使用自己的 IDataObject 实现通过 CFSTR_FILEDESCRIPTOR 和 CFSTR_FILECONTENTS 将数据传输到 Explorer。
一切似乎都工作正常(即使文件超过 1GB),除了目标 Windows Explorer window 在操作完成之前停止响应。
这里的答案 - CFSTR_FILEDESCRIPTOR/CFSTR_FILECONTENTS 'Copying Files' Dialog missing 没有帮助。
我的 IDataObject 实现基于 https://svn.cyberduck.io/tags/release-4-0/source/ch/cyberduck/core/VirtualFileDataObject.cs
不同之处在于,我没有在复制之前将整个虚拟文件加载到内存中,而是将 CFSTR_FILECONTENTS 设置为一个指向 IStream 实现的指针,该函数具有以下功能:
Public Sub Read(pv() As Byte, cb As Integer, pcbRead As IntPtr) Implements IStream.Read
Marshal.WriteInt64(pcbRead, 0, stream.Read(pv, 0, cb))
End Sub
澄清:我正在尝试将文件从我的应用程序传输到 Windows 资源管理器,而不是相反。
如有任何帮助,我们将不胜感激。
对不起我的英语。
您可以实现IDataObjectAsyncCapability
接口,让资源管理器异步提取数据。
有关其工作原理的说明,请参阅 Dragging and Dropping Shell Objects Aynchronously。 drop source异步到运行需要的步骤是:
- Create a data object that exposes IAsyncOperation/IDataObjectAsyncCapability.
- Call SetAsyncMode with fDoOpAsync set to VARIANT_TRUE to indicate that an asynchronous operation is supported.
- After DoDragDrop returns, call InOperation:
- If InOperation fails or returns VARIANT_FALSE, a normal synchronous data transfer has taken
place and the data extraction process is finished. The source should
do any cleanup that is required, and proceed.
- If InOperation returns
VARIANT_TRUE, the data is being extracted asynchronously. Cleanup
operations should be handled by EndOperation.
- Release the data object.
- When the asynchronous data transfer is complete, the data object normally notifies the source through a private interface.
我正在尝试在 VB.NET 中使用 IStream 将虚拟文件复制到 Windows 资源管理器,使用包装器 class 将调用链接到我自己的 IO.Stream 实现。
我正在使用自己的 IDataObject 实现通过 CFSTR_FILEDESCRIPTOR 和 CFSTR_FILECONTENTS 将数据传输到 Explorer。
一切似乎都工作正常(即使文件超过 1GB),除了目标 Windows Explorer window 在操作完成之前停止响应。
这里的答案 - CFSTR_FILEDESCRIPTOR/CFSTR_FILECONTENTS 'Copying Files' Dialog missing 没有帮助。
我的 IDataObject 实现基于 https://svn.cyberduck.io/tags/release-4-0/source/ch/cyberduck/core/VirtualFileDataObject.cs
不同之处在于,我没有在复制之前将整个虚拟文件加载到内存中,而是将 CFSTR_FILECONTENTS 设置为一个指向 IStream 实现的指针,该函数具有以下功能:
Public Sub Read(pv() As Byte, cb As Integer, pcbRead As IntPtr) Implements IStream.Read
Marshal.WriteInt64(pcbRead, 0, stream.Read(pv, 0, cb))
End Sub
澄清:我正在尝试将文件从我的应用程序传输到 Windows 资源管理器,而不是相反。
如有任何帮助,我们将不胜感激。
对不起我的英语。
您可以实现IDataObjectAsyncCapability
接口,让资源管理器异步提取数据。
有关其工作原理的说明,请参阅 Dragging and Dropping Shell Objects Aynchronously。 drop source异步到运行需要的步骤是:
- Create a data object that exposes IAsyncOperation/IDataObjectAsyncCapability.
- Call SetAsyncMode with fDoOpAsync set to VARIANT_TRUE to indicate that an asynchronous operation is supported.
- After DoDragDrop returns, call InOperation:
- If InOperation fails or returns VARIANT_FALSE, a normal synchronous data transfer has taken place and the data extraction process is finished. The source should do any cleanup that is required, and proceed.
- If InOperation returns VARIANT_TRUE, the data is being extracted asynchronously. Cleanup operations should be handled by EndOperation.
- Release the data object.
- When the asynchronous data transfer is complete, the data object normally notifies the source through a private interface.