Is there a way to get a control's handle which is inside a dialog by its relative location in the dialog?
I have seen WindowFromPoint , however this function works only if the window is on the top of the Z axis.
Is there another way to do it?
bar.
As far as I can tell by a quickie applet I threw together, WindowFromPoint works even if a window/control is at the bottom of the Z-Order. I found the hWnd of several different windows/controls with Spy++ (a VS tool) and then used my mouse hovering applet to view the same window and I consistently got the same hWnd.
// C Code...
POINT pt;
if( GetCursorPos(&pt) )
hWndCurrentPoint = WindowFromPoint( pt );
If you have a more specific example on when WindowFromPoint might not work, post it and I'll take a look.
Jim
OK tnx for the advice Jimh.
Bar.
Hi,
There is also a ChildWindowFromPoint function for child windows. The point must be converted to client coordinates, that is relative to the upper left corner of the parents client area...
invoke GetCursorPos, offset pt
invoke ScreenToClient, [hParent], offset pt
invoke ChildWindowFromPoint, [hParent], offset pt
Tnx , that was excatly what I was looking for donkey.
bar.