I want to be able to drag an image from my application window over controls on other windows, and releasing it, get the handle of the control I released it over.

Any ideas?
Posted on 2002-06-04 19:02:50 by Homer
You can use SetCapture to direct all the mouse input to your window, and ReleaseCapture when done with the drag.

Typically, you can call SetCapture when you receive WM_LBUTTONDOWN with the cursor's coordinates being within your image. And upon the receipt of WM_LBUTTONUP, check to see if the mouse input is already captured. If yes, release the capture. Since all WM_MOUSEMOVEs and the WM_LBUTTONUP are sent to your own window, you can easily proceed them as you like. WindowFromPoint would suit most of the needs.
Posted on 2002-06-05 05:37:10 by C.Z.
Bomb01, pretty well said all that is needed to say, but you can look at my TopMost tool source, as it has all this done in code...


Posted on 2002-06-05 14:26:24 by NaN
I had a problem when it came to using WindowFromPoint.
My MASM Include (user32) specifies two parameters for this call.
But the Windows API says just a pointer to a POINTS structure.
What's the other parameter ??
Posted on 2002-06-05 18:45:53 by Homer
It doesnt POINT to the structure... it IS the structure..

You see this in other C++ doc's of the API.

I dunno why for sure, i guess the "smart' HLL compilers know in this case that the "POINTER" is really unpacking the structure into separate params... kinda stupid to break the steadfast rules...

anyways.. just pass: Point.x, Point.y instead of addr Point :rolleyes:

This is a cut from the source, linked above.. (modified by f0dder)
invoke	ClientToScreen, [hWnd], addr PT

invoke WindowFromPoint, [PT.x], [PT.y]

Posted on 2002-06-05 21:50:20 by NaN
Thanks for the source, I'll explain what I meant...

m$ declared two structs : POINT and POINTS.
One uses dwords, and the other uses words.

When I looked up GetWindowFromPoint in the microsoft win32 api helpfile, it stated to use a POINTS struct, not POINT.
That was dealt with deftly in the source you referred.
I coded a quickie but decent popup killer..
Here is the fruit of my labors.

The Capture is a little wiggy, I'd appreciate beta testing.
It seems to work when it darn well wants to...
...but the rest of it works like a charm

Posted on 2002-06-06 02:52:17 by Homer