PDA

Click to See Complete Forum and Search --> : Find text from a stream / textbox / handle


rekcus
Aug 10th, 2000, 11:23 PM
"Find text from a stream / textbox / handle"

Have a need to know if there is such an API.

Thanks,

Aug 11th, 2000, 02:05 PM
Do you mean you want to retrieve the text from another application?

Type POINTAPI
X As Long
Y As Long
End Type

Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd 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
Public Declare Function WindowFromPointXY Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long


Function GetCaption(hWnd)
hwndLength% = GetWindowTextLength(hWnd)
hwndTitle$ = String$(hwndLength%, 0)
a% = GetWindowText(hWnd, hwndTitle$, (hwndLength% + 1))

GetCaption = hwndTitle$
End Function

Private Sub Timer1_Timer()
Dim pnt As POINTAPI
MousePointer = 0
GetCursorPos pnt
yhwnd% = WindowFromPointXY(pnt.X, pnt.Y)
Text1.text = GetCaption(yhwnd%)
End Sub