place the following declares in a module
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowWord Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Integer
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE

Public Type POINTAPI
X As Long
Y As Long
End Type

place this code inside a timer with an interval of 1 on a form


Dim point As POINTAPI, pointX As Long, pointY As Long, hwndLast As Long
Dim wHwnd As Long, pHwnd As Long, wClass As String * 100
Dim pClass As String * 100, wTxt As String * 100, pTxt As String * 100
Dim wTxtLen As Long, pTxtLen As Long, z As String
On Error Resume Next
Call GetCursorPos(point)
pointX& = point.X
pointY& = point.Y
wHwnd& = WindowFromPoint(pointX&, pointY&)
If wHwnd& <> hwndLast& Then
Cls
Print "Window hWnd: " & wHwnd&
z$ = GetClassName(wHwnd&, wClass$, 100)
Print "Window Class Name: " & Left(wClass$, z$)
z$ = GetWindowText(wHwnd&, wTxt$, 100)
Print "Window Caption: " & Left(wTxt$, z$)
wTxtLen& = GetWindowTextLength(wHwnd&)
Print "Window Text Length: " & wTxtLen&
pHwnd& = GetParent(wHwnd&)
If pHwnd& <> 0& Then
Print ""
Print "Parent Window hWnd: " & pHwnd&
z$ = GetClassName(pHwnd&, pClass$, 100)
Print "Parent Window Class Name: " & Left(pClass$, z$)
z$ = GetWindowText(pHwnd&, pTxt$, 100)
Print "Parent Window Caption: " & Left(pTxt$, z$)
pTxtLen& = GetWindowTextLength(pHwnd&)
Print "Parent Window Caption Length: " & pTxtLen&
Else
Print ""
Print "Parent Window hWnd: N/A"
Print "Parent Window Class Name: N/A"
Print "Parent Window Caption: N/A"
Print "Parent Window Caption Length: N/A"
End If
End If


if the syntax correct itself from being inside here it should show you what you want and give you a good idea of how yo get more information