Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Get Word Under Mouse (DLL)


  • Please log in to reply
15 replies to this topic
corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
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

; 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%```(`)`,.`=/\+-*[email protected]#$`%^&*?<>~`;`:`{`}`[`]
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 ;) )

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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.

Jon
  • Members
  • 349 posts
  • Last active: Aug 30 2011 08:35 PM
  • Joined: 28 Apr 2004
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?

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

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...

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

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 :) . Interesting. Looks like a bit of light reading :roll: .

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Updated to version 0.0.2 Beta
- A few bugs squished
- Fixed script crash under Win98?

  • Guests
  • Last active:
  • Joined: --
hi, i have a question
how could you create the dll file?
and is there a way to read its source?
thanks

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

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

I use BCX for creating .DLL files (compiled using Pelles C).

and is there a way to read its source?
thanks

Asking the author is the preferred method ;) :)

Navid
  • Guests
  • Last active:
  • Joined: --
I want to use it in VB6.
can you guide me?

savage
  • Members
  • 207 posts
  • Last active: Jul 03 2008 03:12 AM
  • Joined: 02 Jul 2004
It should work like using any other dll in vb6. Google is your friend.

heresy
  • Members
  • 291 posts
  • Last active: Sep 26 2008 10:47 PM
  • Joined: 11 Mar 2008
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

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

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... ;)

interested_visitor
  • Guests
  • Last active:
  • Joined: --
It makes winword crashed.
Maybe, it could be usefull to delete the tips. :shock:

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

It makes winword crashed.
Maybe, it could be usefull to delete the tips. :shock:

Could you please provide a bit more info? It's been a while but I may be able to locate the source and look into it...

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008
I tried the code in the opening post and it does not work.

The example code opens the script in notepad, when I place my mouse over any word I do not get a tooltip.

I am using ahk 1.1.13.01 ansi, 32 bit.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.