-->

Cross-application drag-and-drop in Delphi

2019-01-11 11:42发布

问题:

I would like to create a Delphi application for Windows XP which allows dropping of files dragged from Windows Explorer (the Desktop or folder windows) or other applications which support this operation (such as Total Commander). What about vice-versa? When the user drags an icon from my application, I should be able to set the contents of the dragged object to custom data.

My goal is to create a custom application toolbar, onto which I can drop applications and show their icons or drag applications or other entities from it.

How can this be done?

回答1:

This can be done with The Drag and Drop Component Suite. It also has examples for what you want.



回答2:

Raymond Chen has a nice series of articles about drag&drop:

  • What a drag: Dragging a virtual file (HGLOBAL edition)
  • What a drag: Dragging a virtual file (IStorage edition)
  • What a drag: Dragging a virtual file (IStream edition)

There are many other good articles on his blog when you search for drag and drop.