Hello Netizens,
I have a .NET application that can do drag & drop files from/to Explorer.
All works fine - until I tried to implement clipboard support. The problem
is with cut and paste. I have read (and understood?) "Handling Shell Data
Transfer Scenarios" in MSDN,
http://msdn2.microsoft.com/en-us/library/aa969396.aspx
I set the clipboard like this:
StringCollection files = new StringCollection();
files.Add( ... some filename ... );
DataObject dataObject = new DataObject();
dataObject.SetFileDropList( files );
dataObject.SetData( ShellClipboardFormats.CFSTR_PREFERREDDROPEFFECT,
DragDropEffects.Move );
Clipboard.SetDataObject( dataObject );
After that, I can do a "paste" in Explorer, and the file system object is
moved to the new location - everything fine so far.
But I cannot get feedback in my program about the sucessful paste. I do not
know when to update my GUI. MSDN says that Explorer will put the format
CFSTR_PASTESUCCEEDED into the clipboard when the paste is finished.
I can observe that the shell has performed the move correctly, and I
conclude that the shell did correctly interpret the
CFSTR_PREFERREDDROPEFFECT format with value
DragDropEffects.Move.
I can also observe that the clipboard is not cleared after the paste (which
would be normal behavior when I do cut/paste between Explorers). In fact,
the clipboard remains completely unchanged after the paste - which, for
example, would allow another paste, which must fail, because the object is
no longer at its original location.
So, please, what is wrong here?
Greetz
Paule