AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get Word Under Mouse (DLL)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources
View previous topic :: View next topic  
Author Message
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Tue Jun 07, 2005 10:07 am    Post subject: Get Word Under Mouse (DLL) Reply with quote

Here's a function and DLL I put together for retrieving the current word under the mouse in an Edit control. If there is enough interest I may be able to expand functionality to include a few other types of controls.

Download

Updated to version 0.0.2 Beta
- A few bugs squished
- Test script changed to use tooltip to display word

Code:
; GetWordUnderMouse Test Script
; only Edit controls currently supported
; --------------------------------------
; Place the mouse over text in an edit control to
; retrieve the current word under the mouse.
; --------------------------------------
#Persistent

; Open this script in notepad for testing...
Run, Notepad %A_ScriptFullPath%
SetTimer, disp, 200
Return

^j::
SetTimer, disp, Off
ToolTip
ExitApp
Return

disp:
delimiter1 = "%A_Space%```(`)`,.`=/\+-*!@#$`%^&*?<>~`;`:`{`}`[`]
word := GetWordUnderMouse(delimiter1)
ToolTip, %word%
Return


GetWordUnderMouse(delim)
{
  ; delim = character(s) specified to separate words
  ; if no delimiter character(s) specified then the entire line of text
  ; under the mouse pointer will be returned.
  VarSetCapacity(word, 2048)
  RetVal := DllCall("gwrd.dll\GetWord", "str", word, "str", delim, "Uint")
  ; The DLL returns the handle to the control the mouse is over
  Return, %word%
}


(WARNING - Beta version - Use at your own risk Wink )


Last edited by corrupt on Wed Jun 08, 2005 4:53 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10450

PostPosted: Tue Jun 07, 2005 11:13 am    Post subject: Reply with quote

Nice! There's also an item on the to-do list to research Active Accessibility, which is said to have the ability to get the text-under-mouse from many different control types.
Back to top
View user's profile Send private message Send e-mail
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Tue Jun 07, 2005 2:54 pm    Post subject: Reply with quote

That looks really good corrupt (especially with the deliminators). I can think of quite a few things it will be useful for. Would it be possible to make it work under browser controls i.e Firefox and Internet Explorer?
Back to top
View user's profile Send private message Send e-mail
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Wed Jun 08, 2005 4:44 am    Post subject: Reply with quote

Jon wrote:
That looks really good corrupt (especially with the deliminators). I can think of quite a few things it will be useful for. Would it be possible to make it work under browser controls i.e Firefox and Internet Explorer?
Only the address bar in IE so far...
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Wed Jun 08, 2005 4:47 am    Post subject: Reply with quote

Chris wrote:
Nice! There's also an item on the to-do list to research Active Accessibility, which is said to have the ability to get the text-under-mouse from many different control types.
Thanks Smile . Interesting. Looks like a bit of light reading Rolling Eyes .
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Wed Jun 08, 2005 4:55 am    Post subject: Reply with quote

Updated to version 0.0.2 Beta
- A few bugs squished
- Fixed script crash under Win98?
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Fri Jun 10, 2005 9:19 am    Post subject: Reply with quote

hi, i have a question
how could you create the dll file?
and is there a way to read its source?
thanks
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Fri Jun 10, 2005 9:38 am    Post subject: Reply with quote

Anonymous wrote:
hi, i have a question
how could you create the dll file?

I use BCX for creating .DLL files (compiled using Pelles C).
Anonymous wrote:
and is there a way to read its source?
thanks
Asking the author is the preferred method Wink Smile
Back to top
View user's profile Send private message Visit poster's website
Navid
Guest





PostPosted: Wed Sep 14, 2005 2:05 pm    Post subject: Can you write the syntax for using this dll in visual basic? Reply with quote

I want to use it in VB6.
can you guide me?
Back to top
savage



Joined: 02 Jul 2004
Posts: 205

PostPosted: Thu Sep 15, 2005 12:44 am    Post subject: Reply with quote

It should work like using any other dll in vb6. Google is your friend.
_________________
<enormous animated gif>
Back to top
View user's profile Send private message AIM Address
heresy



Joined: 11 Mar 2008
Posts: 131

PostPosted: Wed Apr 16, 2008 7:46 am    Post subject: Reply with quote

if it's not restricted to specific control type.
i would like to make tooltip dictionary
which gets translated local word for that english word
sigh
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Fri Apr 18, 2008 6:58 am    Post subject: Reply with quote

heresy wrote:
if it's not restricted to specific control type.
i would like to make tooltip dictionary
which gets translated local word for that english word
sigh
It is currently restricted to Edit based controls (Edit, RichEdit, etc...). Having a look at the example will give you an idea of what might be possible with the current methods used... Wink
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group