Programmatically paste files from the clipboard: Copy or Move?

I am trying to make a WPF application so that I can copy / cut and paste file information and it copied / moved them to a special folder. I know that I can get the paths of the copied / cropped files using

var files = Clipboard.GetFileDropList(); 

But I would like to know if I need to copy or move files? I read something about listening to WM_COPY and WM_CUT . And I tried to connect the Hwnd hook to my window, and it did not work, neither WM_COPY nor WM_CUT were called. And I tried everything.

So, what is the best way to determine if files have been copied or cut? And some code examples or links will really help a lot.

Thanks.

+4
source share
2 answers

Work with fooobar.com/questions/463826 / ... back. and for copying - replace 5 with 2.

+2
source

You cannot set the hook. I know from experience. Windows only allows left and right clicks from .NET. You will need to create a win32 dll and then call it in your .NET code to grab the hooks if you need to take this approach.

Or, as simple as this application sounds, just write it using the API anyway in C or C ++.

If this is just a small function in your application, and not the application itself, you will either have to find something to perform the injection and pass it into your .NET application, or you will need to find a way t connected with hooks.

+1
source

Source: https://habr.com/ru/post/1389507/


All Articles