Groups | Blog | Home
all groups > c# > october 2007 >

c# : How to read a word from an other application ?


Muhammed Soyer
10/7/2007 11:48:07 PM
Hi,
I am trying to write dictionary application where I want a pass a
selected word from any application by ctrl+right click on the word.

How can I achieve this?
How can I read a selected word from other applications?
How can I register my application on a specified hot key sequence?

Nicholas Paldino [.NET/C# MVP]
10/8/2007 12:14:20 AM
Your best bet would be to write a global message hook so that you can
handle the ctrl-right combination. Once you have that though, you aren't
going to find it easy to find the currently selected word in an application.
The reason for this is that there is not a uniform way that an application
conveys this information.

You can try the accessibility apis, as they unify the access to apps
somewhat. You can also try using the WM_GETTEXT windows message, to get the
text, but that's not going to help with the selected text (just all text).

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

[quoted text, click to view]
AddThis Social Bookmark Button