2

I'm making an app that has some functionality of windows explorer. Actually I have to make a copy/paste actions. My question is what does windows copy to clipboard, when I'm right-clicking the file and the choose 'Copy'?

Here's my Paste code:

var files = (string[])Clipboard.GetDataObject().GetData("FileName");
FileInfo info = new FileInfo(item);
info.CopyTo(Path.Combine(currentFolder, info.Name));
GaaRa
  • 520
  • 6
  • 21
  • The item is a shell data object. You can just ask the shell to create one for you instead of trying to replicate it. From native code, this would be done with `IShellItem::BindToHandler(nullptr, BHID_DataObject, riid, ppvOut)`. I think there are managed wrappers for this but I can't find them. – Raymond Chen Sep 14 '11 at 10:26

1 Answers1

0

There are many formats present on the clipboard as a result of the copy. In XP, I get this:

* DataObject
* Shell IDList Array
* HDROP
* Preferred DropEffect
Shell Object Offsets
FileName
FileNameW
* Ole Private Data

The ones with * were read by Explorer when I pasted.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62