Is it possible to Drag and Drop to Tray?

Is it possible to Drag and Drop to Tray?

Post by Matthew Douglas » Tue, 27 Jun 2000 04:00:00



I remember trying to figure out if it was possible to drag and drop on to an
icon in the tray about a year ago and having no luck at all doing so.

Does anyone know a way of doing this?

I'm thinking it might be possible to inject something into the explorer
process, call RegisterDragDrop inside the process for the TrayNotifyWnd(or
whatever its class is called, I don't remember) and pass in an IDropTarget
that can sit in the explorer process.  Then when it gets called, throw it
back over the process boundary to my tray icon and process the drop.  (Many
difficult, painful steps removed :)  The one problem I see with this, is
that this will make the entire window (and thus every icon in the tray)
appear droppable (verb?).

So what I'd really need is some way to locate where in the tray my icon
rests and only allow drops when the mouse cursor is over my icon.  Only
problem is I don't have a clue how to do that -- other than really ugly
tecniques like trying to identify my icon in a bitmap of the tray window as
a whole.

So before I go insane and start trying to do all of this -- anyone got any
better ideas.  And just to make life more difficult -- I'd like this to work
on 95/98/NT4/2000.  Although, out of sheer desperation, I'll take solutions
for any individual platform :)

Thanks
Matt

 
 
 

Is it possible to Drag and Drop to Tray?

Post by Jim Barr » Wed, 28 Jun 2000 04:00:00



> I remember trying to figure out if it was possible to drag and
> drop on to an icon in the tray about a year ago and having no
> luck at all doing so.

> Does anyone know a way of doing this?

As far as I know, it is not possible because there is no documented way of
getting the icon coordinates. The approach that you outlined is interesting,
but I can think of all sorts of problems.

Cheers,

- Jim

 
 
 

Is it possible to Drag and Drop to Tray?

Post by Matthew Douglas » Wed, 28 Jun 2000 04:00:00


Well I went ahead and did my best to tempt fate and started work on this.
The method I outlined in the first post worked perfectly for turning the
tray into a drop target.

The major problem I have left is the one you mention: figuring out whether
the drop is on top of my icon or on top of another icon.

Other problems exist if someone else registers the window as a drop target
before I get at it -- then my call to RegisterDragDrop fails with an already
registered message.  I figure I could just call RevokeDragDrop and try
again, but I feel bad about intentionally breaking someone else's already
working applet.

The implementation so far is screaming out to be an open API that can
communicate with any number of programs that want to get drag and drop on to
the tray.

Quote:> As far as I know, it is not possible because there is no documented way of
> getting the icon coordinates. The approach that you outlined is
interesting,
> but I can think of all sorts of problems.

Out of curiosity, what are some of the problems you envision?

Matt

 
 
 

Is it possible to Drag and Drop to Tray?

Post by Jim Barr » Thu, 29 Jun 2000 04:00:00



> Out of curiosity, what are some of the problems you envision?

Just the ones you mentioned already, really. Only one drop target can be
registered at a time for a given window. Detecting the position of the icon
might be tricky because you have to deal with different colour depths. But
let us know if you get it working!

Cheers,

- Jim