How to read a word from an other application ?

M

Muhammed Soyer

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?

Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top