Check this out. Put two TextBoxes and a Timer (with interval 10) onto a form. Add the following code to the form, then run.
Code:
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
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 GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount 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
Dim ghWnd As Long
Private Sub Timer1_Timer()
    Dim mypt As POINTAPI
    GetCursorPos mypt
    ghWnd = WindowFromPoint(mypt.x, mypt.y)
    Dim mystr As String * 400
    GetWindowText ghWnd, mystr, 400
    Text1.Text = mystr
    GetClassName ghWnd, mystr, 400
    Text2.Text = mystr
End Sub