Can I get word under mouse in any program in C# app?

Can I get word under mouse in any program in C# app?
A state of nonexistence
Posted by Void // Sun, Jan 15, 2006 9:56 PM

I would like to capture the word (text) under the mouse from any program in real time.  If the mouse pauses over a word, I would get a callback or notification that includes the actual text. This would not be limited to my own program. I want to catch the text on any program.

I know I could watch the clipboard and use cut or copy to get the text from another app.

I want to make a program that checks the word against a local word table so that my program window can show information about the word the mouse is over.


  Shark_M
 
 
  Sun, Jan 15 2006 10:10 PM
in a texbox for examle, handle the MouseHover Event,
and then you might have to find a way to get the x y co-ordinates, and the then the word location and copy it to clipboard or select it




  Sven Groot
  Asphalt, and trouble!
 
  Mon, Jan 16 2006 6:32 AM
You can use TextBox.GetCharIndexFromPosition to get the index the mouse is over, then search backwards and forwards from that index for word boundaries and you'll have your word.

  mot256
  Beyond ASM... OOP
 
  Mon, Jan 16 2006 7:25 AM
I’ve not tried it in C# yet, but I have an article in Delphi that shows you how to hook your code to global mouse events. It is not Delphi specific in the sense that you use Windows API calls to do the hook. On the fact about how to get the text from the textbox (you get the window handle through the hook call-back) displaying the text you want is a thing I would very much like to know myself. But, should you be able to find the “class” of the “textbox” window does not mean that the text displayed on the screen is made public via some method or property (it could be a custom “textbox” drawn by the application it self displaying text from a private property/method).
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值