Console application using Clipboard.GetFileDropLis

2019-06-21 20:06发布

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条回答
2楼-- · 2019-06-21 20:52

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.

查看更多
登录 后发表回答