|
-
Jul 28th, 2000, 08:54 AM
#1
Thread Starter
New Member
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
-
Jul 28th, 2000, 10:28 AM
#2
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,,,,
-
Jul 28th, 2000, 10:45 AM
#3
Thread Starter
New Member
Thanks for the reply.
I would like text from some other program that I can manipulate in my own program.
Thanks again.
Joseph
-
Jul 28th, 2000, 02:25 PM
#4
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
-
Jul 31st, 2000, 07:50 PM
#5
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|