How to execute action on destination of copy-paste, move and drag-and-drop operations

91 Views Asked by At

In my Shell Namespace Extension I want to execute some action on the files that user has copied from it immediately after the copy process. It is a resource consuming process, so I would really prefer to first copy a file and only after that start processing it rather than present already processed items to the user.

Implementing a Drop Handler approach on Folder and Directory Classes works, but it appears to be too frustrating for end-user (to remember that items should be copied only with right-click drag-and-drop and not via Ctrl+C / Ctrl+V or any other mean).

So I am trying to find a way to execute this action right after "normal" copy.

Both IDataObject and ITransferSource interfaces do not provide any information about the destination of the data except for ITransferSource::MoveItem. I know it is done intentionally on the IDataObject since target could be whatever and the source should not know about it.

So for my specific task I think I need to find answers for following questions:

  1. Is it possible to know from within IDataObject "who" is the receiver of the data: Explorer or any other application? I guess we can skip special Explorer-like cases like TotalCommander.
  2. If it is somehow possible to know that Drop Target is an Explorer window - is it possible to know the destination folder?
  3. Is it possible to know if the copy process with IDataObject ended successfully (except for tracking if IStream was read till the very end)?
  4. Is it possible to know the destination for the ITransferSource::OpenItem?
  5. Is it possible to know if the copy process with ITransferSource::OpenItem ended successfully?
0

There are 0 best solutions below