Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim curwnd As Long
Dim mPoint As POINTAPI
Private Sub Form_Load()
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
GetCursorPos mPoint
curwnd = WindowFromPoint(mPoint.x, mPoint.y)
Me.Caption = curwnd
End Sub