Obtaining Handle of Window Cursor Positioned Over:   Return to List

Public Type POINTAPI
    X As Long
    Y As Long
End Type

Public Declare Function WindowFromPoint Lib "user32" _
    (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Public Declare Function GetCursorPos Lib "user32" _
    (lpPoint As POINTAPI) As Long

Private Sub Command1_Click()
    Dim P as POINTAPI
    K$ = GetCursorPos(p)
    J$ = WindowFromPoint (p.x, p.y)' Window Handle
End Sub



Note to Webmaster