When they first asked for this, I said it couldn't be done. Then they showed me an app that could do it.
To simplify the discussion, lets say I want to perform a "special action" when a "special" key is pressed using the text that is highlighted in whatever window has focus, regardless of what the application is.
Put another way, suppose I have Notepad running, and in the text that it is displaying I hightlight the word "Hello". Then I press something like <ctrl><f12> and my program, which is running but is not the application with focus, responds to the keystroke by performing a special action where the parameter is the word "hello". (As a silly example, lets say it generates a text file, puts "hello" in it, and saves it. )
Now - I've seen an app do this (something very similar)! It extracted selected text from a simple app I wrote - so there's no special Office Automation magic or something like that going on.
The app that I saw do this isn't a dot net app, but hopefully it is still possible in dot net.
My only idea is to somehow loop through all the windows on the desktop, find the one with focus, and then extract whatever text is currently highlighted. Zowie! Easy to say, right
I also need to somehow capture the "special" keystroke no matter what application has focus.
I need help with every step I've mentioned.
... or maybe there's a better way to approach it
Help!
Kirk