Are you going to make your own Spy++?
I just something that sound like what you mention and hope it what you looking for.
If you want the sample program, just email me and I'll send you a copy.
Code:
'Code under Basic Module
Public Sub Get_WindowInfo()
On Error GoTo Get_Info_Err
Dim xhWnd As Long
Dim xWndText As String
Dim xWndClass As String
Dim xReturn As String
'GetWindows Handle
GetCursorPos xPt
xhWnd = WindowFromPoint(xPt.X, xPt.Y)
'Get Windows Caption
If xhWnd <> 0 Then
frmMain.lblWindowHwnd.Caption = "Window hWnd: " & xhWnd
xReturn = String(255, Chr(0))
If GetWindowText(xhWnd, xReturn, 100) Then
xWndText = Left(xReturn, InStr(1, xReturn, Chr(0), vbBinaryCompare) - 1)
End If
Else
frmMain.lblWindowHwnd.Caption = "Window hWnd: Not Available"
End If
frmMain.lblWindowText.Caption = "Window Text: " & xWndText
'GetWindowClass Name
If xhWnd <> 0 Then
xReturn = String(255, Chr(0))
If GetClassName(xhWnd, xReturn, Len(xReturn)) <> 0 Then
frmMain.lblClassName.Caption = "Window Class Name: " & Left(xReturn, InStr(1, xReturn, Chr(0), vbBinaryCompare) - 1)
Else
frmMain.lblClassName.Caption = "Window Class Name:"
End If
End If
Exit Sub
Get_Info_Err:
frmMain.lblWindowText.Caption = "Window Caption:"
frmMain.lblWindowHwnd.Caption = "Window hWnd:"
frmMain.lblClassName.Caption = "Window Class Name:"
End Sub
'Code under Form
Option Explicit
Private Scan As Boolean
Private Sub ImgScan_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Scan = True
Screen.MouseIcon = ImgScan.Picture
Screen.MousePointer = vbCustom
End If
End Sub
Private Sub ImgScan_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Scan Then Get_WindowInfo
End Sub
Private Sub ImgScan_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Scan = False
Screen.MousePointer = vbDefault
End Sub
I just amended my code. 
[Edited by Chris on 06-17-2000 at 04:55 AM]