All window handle from point
-
hi, how can i get all the windows handle from a point? For example if in (100,100) i have two windows overlapped, i want to get the handle of the topmost window and the handle of the other window.
-
hi, how can i get all the windows handle from a point? For example if in (100,100) i have two windows overlapped, i want to get the handle of the topmost window and the handle of the other window.
WindowFromPoint, ChildWindowFromPointEx. For windows under windows, you'll have to EnumWindows and do your own hit testing.
/* Charles Oppermann */ http://weblogs.asp.net/chuckop
-
hi, how can i get all the windows handle from a point? For example if in (100,100) i have two windows overlapped, i want to get the handle of the topmost window and the handle of the other window.
Use
EnumWindows
to enumerate the windows. UseGetWindowRect
to get the rectangle of the window. Then usePtInRect
to check if the point of interest lies within the window rectangle.«_Superman_» _I love work. It gives me something to do between weekends.
-
hi, how can i get all the windows handle from a point? For example if in (100,100) i have two windows overlapped, i want to get the handle of the topmost window and the handle of the other window.
Additionally to what the others have said, the "get the rectangle and check if the point is inside it" method might not work with non-rectangular windows (layered windows with per-pixel alpha (see here[^]) or windows with a non-rectangular window region (see here[^]). I wonder if sending these kinds of windows the WM_NCHITTEST[^] message could tell you if the point is on the window or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
-
Additionally to what the others have said, the "get the rectangle and check if the point is inside it" method might not work with non-rectangular windows (layered windows with per-pixel alpha (see here[^]) or windows with a non-rectangular window region (see here[^]). I wonder if sending these kinds of windows the WM_NCHITTEST[^] message could tell you if the point is on the window or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
That's what RealChildWindowFromPoint handles.
/* Charles Oppermann */ http://weblogs.asp.net/chuckop