I'm stealing this story from one of my colleagues.
I remember one app from a long time ago that had a feature where you could hit a global short cut key (or something like that) to launch the dictionary. It was also smart in that it would detect the current selected text and immediately search the dictionary for that term.
One day I was running a Perl script that took several hours to run. It was nearly done and for whatever I decided to launch the dictionary. It sent a Ctrl+C to my Perl script and killed it.
And that's why you don't send Ctrl+C to arbitrary applications.
Active Accessibility gives you access to
the text under the cursor.
There's also a newer interface known as UI Automation
which has a handy method called
ITextProvider::
.
(On the managed side, you have
System.
.)
Update: Commenter parkrrrr
points out
the
ITextProvider::
.
is the provider-side interface.
The interface for applications wishing to read the selected text
is
IUIAutomationTextPattern
.