Grab text as it arrives in a RichEdit belonging to an external chat program?
Posted on 2006-06-11
I'm creating a C# app which will monitor a chat program's main chat window (a RichEdit control). I've successfully coded to grab the handle to the RichEdit control, and do stuff like grab the last line of text (using SendMessage along with EM_GETLINE, for example).
However, I'm stumped on how to fire off an event to my C# app when new text enters the foreign chat window. For example, if someone says "hi", I want my app to be able to react and grab the text. Specifically, the chat program appears to fire off an EM_REPLACESEL message containing the new text.
I need details on how to make it so that my app can be made aware of new text arriving in the foreign app's RichEdit control, so that I can then process the new text. I don't want to poll for new messages, rather I want to be able to respond to an event created as a result of new text arriving in the RichEdit control. Maybe using a local hook? I don't know.
The person providing the best, most detailed solution wins all 500 points. Please help, thanks. :-)