Results 1 to 5 of 5

Thread: Mouse over text

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    3

    Unhappy

    I would like to be able to detect a word that my mouse cursor is on. I do not need it to work within my own program but be able to determine text in another program.

    Can anyone help with this.

    I am using VB4.0 /32


    Joseph

  2. #2
    Guest
    just make clear that ..... u want text from within ur programm or u want text from someother programme into ur programme,,,, so i can think furthor on it,,,,

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    3

    Smile

    Thanks for the reply.

    I would like text from some other program that I can manipulate in my own program.

    Thanks again.

    Joseph

  4. #4
    Guest
    You mean, get all other text that the mouse is over?

    Code:
    Needed:  Form, Module, Textbox, Timer
    Type POINTAPI 'Declare types
    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
    GetCursorPos pnt
    yhwnd% = WindowFromPointXY(pnt.X, pnt.Y)
    Text1.text = GetCaption(yhwnd%)
    End Sub

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    3
    Thanks for that. But it wasn't exactly what I needed. I need something that will recognize the word that the mouse is on..In a Window. Such as the main window in a terminal app.

    Thanks

    Joseph E

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