Copy and Paste and Drag and Drop operations
are very similar. The result of a drag and drop operation is the same as the
result of a copy and paste operation (if it’s not cancelled), the dropped object
is transferred from the source and pasted to the destination.
Both operations can support shortcuts. If
the “Paste” menu item is available and the copied object supports shortcuts,
then a “Paste as Shortcut” menu item will be shown. For drag and drop, the
end-user can use modifier keys like CTRL to change the operation effect.
If the ShellItem instance represents
a physical file item, its default implementation will support copy paste
operations. In fact, you won’t even be able to prevent these operations,
because the corresponding menu items will be available anyway.
For virtual shell items, you will be able
to use the various following properties:
shortcut (.lnk file) can be created for the item. The default value is true.
CanCopy: the item
can be copied. The default value is false.
CanMove: the item
can be moved. The default value is false.
item is a drop target. The default value is false.
When copy occurs and it’s not a shortcut,
the data that is copied is the ShellItem’s content (check the Item Content
chapter for more on this). By default, for virtual items, it’s not defined so
if you enable copy, you must also override ShellItem’s GetContent()
method or the end-user will see an error message dialog box.
If you want to tune drag and drop operation,
you can override the ShellFolderServer class (for global handling) or
the ShellItem class OnDragDropTarget method.