Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Drag and Drop into external application


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Mar 1, 2018 5:04 AM Last Post By: Gerald Holdsworth
Gerald Holdsworth

Posts: 76
Registered: 5/23/12
Drag and Drop into external application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 8:31 AM
Hi all,

I'm trying to find out how to do a drag, from my Tokyo application, and drop into, e.g. Windows Explorer. I can manage drag and drop within the same application OK, and I can accept dragged files from outside the application - it's just this one which is eluding me (and I can't find anything helpful online either).

The application I'm writing is, essentially, a file explorer - hence why I'm wanting to drag files out of this into explorer. Oh, and I'm also wanting to do this with native Delphi Tokyo components (i.e. no third party add-ons), or just code. And it's the Starter edition, if that makes any difference.

Many thank yous,

Gerald.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Drag and Drop into external application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 9:04 AM   in response to: Gerald Holdsworth in response to: Gerald Holdsworth
Gerald Holdsworth wrote:

I'm trying to find out how to do a drag, from my Tokyo application,
and drop into, e.g. Windows Explorer.

You must implement the COM IDropSource and IDataObject interfaces, and
then call the COM DoDragDrop() function at runtime when you want to
perform a drag operation.

IDropSource interface
https://msdn.microsoft.com/en-us/library/windows/desktop/ms690071.aspx

IDataObject interface
https://msdn.microsoft.com/en-us/library/windows/desktop/ms688421.aspx

DoDragDrop() function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms678486.aspx

Transferring Shell Objects with Drag-and-Drop and the Clipboard
https://msdn.microsoft.com/en-us/library/windows/desktop/bb776905.aspx

Anders Melander has an excellent Drag&Drop suite of components for
Delphi to handle these details for you:

http://melander.dk/delphi/dragdrop/

this one which is eluding me (and I can't find anything helpful online
either).

Then you are not searching very well, because this has been asked and
answered many many times before, with details and examples.

Oh, and I'm also wanting to do this with native Delphi Tokyo
components (i.e. no third party add-ons), or just code.

Then you have to write all of the relevant Shell code yourself, and it
is not trivial to implement from scratch. It is not overly
complicated, but there are a lot of pieces to it.

--
Remy Lebeau (TeamB)
Gerald Holdsworth

Posts: 76
Registered: 5/23/12
Re: Drag and Drop into external application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 11:20 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
You must implement the COM IDropSource and IDataObject interfaces, and
then call the COM DoDragDrop() function at runtime when you want to
perform a drag operation.

OK

Anders Melander has an excellent Drag&Drop suite of components for
Delphi to handle these details for you:

Found his components - but don't want to be using third party components.

this one which is eluding me (and I can't find anything helpful online
either).

Then you are not searching very well, because this has been asked and
answered many many times before, with details and examples.

I have noticed that when I search for things, they don't show up. I did a search on this very forum for Drag and Drop, and it yielded zero results. I also did a web search, which only yielded Anders' components.

Then you have to write all of the relevant Shell code yourself, and it
is not trivial to implement from scratch. It is not overly
complicated, but there are a lot of pieces to it.

That's fine - it'll just take a while.

Cheers,

Gerald.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Drag and Drop into external application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 11:55 AM   in response to: Gerald Holdsworth in response to: Gerald Holdsworth
Gerald Holdsworth wrote:

Found his components - but don't want to be using third party
components.

Why, though?

I have noticed that when I search for things, they don't show up. I
did a search on this very forum for Drag and Drop, and it yielded
zero results.

This forum's search engine sucks.

I also did a web search, which only yielded Anders'
components.

A web search can find prior discussions and examples, in many forums
and coding languages.

--
Remy Lebeau (TeamB)
Gerald Holdsworth

Posts: 76
Registered: 5/23/12
Re: Drag and Drop into external application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2018 5:04 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Why, though?

That is actually a very good question, and one I have been considering.

The basic reason behind not using components is that this application is a demo app to show the usage of a class I have written (which is, incidentally, my first ever attempt at writing a class - and I've been using Delphi since version 1). Therefore, I'm wanting the source code to be able to be opened and compiled from Delphi without any extra components being added. However, I have considered that introducing the drag and drop element to maybe be putting too much functionality into the demo app, as it doesn't actually do any more to showing how to use the class.

I have further considered developing this demo app into a fully featured stand alone app, which does use these components, and available separately from the demo.

This forum's search engine sucks.

Explains that then.

A web search can find prior discussions and examples, in many forums
and coding languages.

I'll have to keep searching...but maybe now just for academic reasons.

Cheers,

Gerald.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02