Console application using Clipboard.GetFileDropList: how to check if that came from a cut or copy operation?

帅比萌擦擦* 提交于 2019-12-12 10:51:22

问题


When you cut/copy files from Windows Explorer, you can get that list of files through the Clipboard.GetFileDropList method.

How can you determine if that list came from a cut or copy operation or notify the other party that the cut/copy operation finished?

The other way around: you can put files to be cut or copied on the clipboard using the Clipboard.SetFileDropList method.

How can you specify that this list is to be copied or cut?

This is about a console application, so I cannot monitor the Windows WM_CUT or WM_COPY messages as suggested by C# Files - in clipboard How to set/read which operation is called - Cut or Copy


回答1:


You need to get the value for the "Preferred DropEffect" format (see CFSTR_PREFERREDDROPEFFECT on MSDN). It contains a STGMEDIUM whose hGlobal field points to a DWORD value. If this value is DROPEFFECT_COPY, it's a copy operation; if it's DROPEFFECT_MOVE, it's a cut operation.



来源:https://stackoverflow.com/questions/20611753/console-application-using-clipboard-getfiledroplist-how-to-check-if-that-came-f

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