Get highlighted text from any window

  • Thread starter Thread starter P?l F
  • Start date Start date
P

P?l F

How can I get a word from any window and copy it to my application?
Someone have told me I possibly can use EM_GETSEL or the EM_GETSELTEXT
"command" in the WinAPI.
I want to select the word or get the word under the mousepointer (like
Babylon translation). Can anyone give me an example?
 
P?l F,

In order to do that, you would want to call the WindowFromPoint API
function through the P/Invoke layer. This will give you a window handle
under the point. At that point, you can get the text, or the selected text
using the previous methods (calling SendMessage with EM_GETSEL or
EM_GETSELTEXT).

Hope this helps.
 
Back
Top