source of text in a drag-drop operation

  • Thread starter Thread starter ben
  • Start date Start date
B

ben

Hi,

I'm using C#, and what I'd like to do is this. I'm dragging text from
an external application (such as word, internet explorer, ect... I
won't the source at runtime), and dropping it into a custom tree view
control.

I'd like the windows form to be able to collect some meta data about
the source of the text, like the application that it came from, and
the filename (word), or the url (ie), etc.

For example, if I have some text in a word document, and I drag it
over to my tree view control, I want the tree view to be able to know
that the source of the text was a word document, and what the file
name was that the text came from.

Is this possible?

Thank you,

Ben
 
You'll want to grab the definition for GetClipboardOwner off of www.pinvoke.net
and think really long and hard about using it. You get a window handle, which
you
can in turn use to get lots of other information, however, most of that will
require
additional Win32 calls to take advantage of.

Some applications may be putting many different formats into the clipboard. Some
of those formats might surface automatable objects that can be used to get the
information you require.
 
Back
Top