I have an application that mimics Windows Explorer, it uses a TcxShellListView amongst other shell controls.
A really nice feature would be to be able to Copy & Paste and Cut & Paste files between the real Windows Explorer and my application.
Drag & Drop already works out of the box, but it seems that DevExpress hasn’t implemented the clipboard side, yet.
Any Ideas?
If you want to implement the copy/paste yourself, the mechanism is almost identical to drag and drop. The drag and drop code that you have will create an
IDataObject. To copy, instead of callingDoDragDropto initiate a drag, simply callOleSetClipboardpassing theIDataObject. And for pasting you callOleGetClipboardto get theIDataObjectfrom the clipboard. And then you simply use the exact same code as for a drop operation to decode theIDataObject. That’s all there is to it.There is another way to do it, probably a better approach in my view. And that is to use
IContextMenuto do the work. And example of this can be found in the TurboPower tpShellShock project. Have a look forShellMenuExecutein theStShlCtlunit. So long as the DevExpress component is using the shell interfaces, i.e.IShellFolder, then you will be able to use that same approach. The advantage of this shell based approach is that you are getting the shell to do the work. If a copy dialog needs to be shown, then the shell will do so. This will give you the most integrated user experience.This code looks like this:
I think you should be able to use this code pretty much as is. I would point out that the handle parameter is declared incorrectly. It should be
HWND. It’s used as the owning window for any dialog that is shown during the call toInvokeCommand.