Gilad_r Centurion
Joined: 03 Mar 2004 Posts: 156
|
Posted: Apr 20th, 2004 04:48 PM Post subject: GetWindowFromPoint |
|
|
this function is used to get a window handle from a point on the screen.
it doesn't ignore disabled windows, and returns the deepest descendent possible.
[vb:1:65a03520f0] Public Function GetWindowFromPoint(ByVal X As Long, ByVal Y As Long) As Long
Dim p As POINTAPI, ch As Long, h As Long
ch = WindowFromPoint(X, Y)
Do
h = ch
p.X = X: p.Y = Y
ScreenToClient h, p
ch = RealChildWindowFromPoint(h, p.X, p.Y)
Loop Until ch = h Or ch = 0
GetWindowFromPoint = h
End Function[/vb:1:65a03520f0]
the declarations:
[vb:1:65a03520f0] Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function WindowFromPoint Lib "user32" _
(ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Private Declare Function RealChildWindowFromPoint Lib "user32" _
(ByVal hWndParent As Long, _
ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Private Declare Function ScreenToClient Lib "user32" _
(ByVal hWnd As Long, _
lpPoint As POINTAPI) As Long[/vb:1:65a03520f0]
enjoy.
Gilad _________________ "you should make amends with you" (Incubus) |
|