VB Code:
Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As Point) As Integer
Declare Function WindowFromPoint Lib "user32.dll" (ByVal xPoint As Integer,
ByVal yPoint As Integer) As Integer
Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" _
ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
In your sub...
VB Code:
Dim rPoint as Point
Dim hWnd as Integer
'string needs to be assigned a buffer.. not sure the right way but I do this
Dim rString as String = " "
'call this on mouseup
GetCursorPos(RPoint)
hWnd = WindowFromPoint(RPoint.X, RPoint.Y)
'returns window text
GetWindowText(hWnd, rString, 35)
MsgBox rString