Results 1 to 2 of 2

Thread: Find text from a stream / textbox / handle

  1. #1

    Thread Starter
    Lively Member rekcus's Avatar
    Join Date
    Jan 1999
    Location
    Kuala Lumpur
    Posts
    122

    Smile

    "Find text from a stream / textbox / handle"

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

    Thanks,
    penyou!

    "The code bytes.."

  2. #2
    Guest
    Do you mean you want to retrieve the text from another application?

    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width