Private Declare Function WindowFromPoint _
Lib "user32" (ByVal xPoint As Long, ByVal yPoint As _
Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim P As POINTAPI
k$ = GetCursorPos(P)
j$ = WindowFromPoint(P.x, P.y)
Print k$; j$
End Sub