Search code examples
.netwindowshandledrag-and-drop

DoDragDrop - get target window handle


I'm using the following code to dragdrop data from listbox into another applications:

Dim data As New DataObject(DataFormats.UnicodeText, ListBox1.Text)
ListBox1.DoDragDrop(data, DragDropEffects.Copy Or DragDropEffects.Copy)

How can I get a handle of the window that receives the data?

I'm looking to build something like "Finder Tool" in Microsoft Spy++.


Solution

  • I don't think that you can know in which window the drop occurred. This is not the philosophy of drag&drop.

    Are you thinking of the 'target icon' that Spy++ shows when you can find a window by moving over the desktop ?

    This is not a drag&drop operation, I guess Spy++ sets the current window cursor to the 'target', captures the mouse, and uses the hit testing Windows API to ask what is under the cursor.