Support Clipboard correctly

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Werkowitz

    #1

    Support Clipboard correctly

    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:

    StringCollectio n files = new StringCollectio n();
    files.Add( ... some filename ... );

    DataObject dataObject = new DataObject();
    dataObject.SetF ileDropList( files );

    dataObject.SetD ata( ShellClipboardF ormats.CFSTR_PR EFERREDDROPEFFE CT,
    DragDropEffects .Move );

    Clipboard.SetDa taObject( 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_PASTESUCC EEDED 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_PREFERRED DROPEFFECT 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
Working...