Sie brauchen für dieses Beispiel einen Timer (Interval=100) und ein Label.
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetWindowText Lib "user32" Alias _
"GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, _
ByVal cch As Long) As Long
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
Dim PT As POINTAPI
Dim mWnd As Long
Dim StrBuffer As String
Private Sub Timer1_Timer()
' Cursorposition auf dem gesamten Screen ermitteln
GetCursorPos PT
' Welches Fenster ist unter dem Mauszeiger ?
mWnd = WindowFromPoint(PT.X, PT.Y)
' Buffer dimensionieren
StrBuffer = String(100, Chr$(0))
' Text des Fensters erfahren
Call GetWindowText(mWnd, StrBuffer, 100)
' Text anzeigen (Null-Terminator entfernen!)
Label1.Caption = Left$(StrBuffer, InStr(StrBuffer, Chr$(0)) - 1)
End Sub