Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 489
Jeroen Wiert Pluimers Avatar asked Nov 01 '22 08:11

Jeroen Wiert Pluimers


1 Answers

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.

like image 198
Thomas Levesque Avatar answered Nov 10 '22 00:11

Thomas Levesque