您的位置:首页 > 移动开发

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

2006-11-08 21:17 609 查看
Can I get word under mouse in any program in C# app?




Void



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).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: