News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Control handle by point inside dialog

Started by realcr, December 30, 2004, 09:17:52 PM

Previous topic - Next topic

realcr

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.

jimh

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

realcr


donkey

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
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

realcr

Tnx , that was excatly what I was looking for donkey.

bar.