Get text selection with IAccessible
I tried to find an example for that, but I failed. Can someone tell me what method to use to get the current text selection. I know it's poss开发者_如何转开发ible in .NET 4.. but I want to make it using winapi so I can use it in .NET 2.
EDIT: This is only possible with UI Autonation.
The UI automation TextPattern allows you to do this (it's more modern than IAccessible). Check out my answer to this SO question: How to get the word under the cursor in Windows?
You can use IAccessilble from the .NET Framework. That likely will not be enough however. But using the information provided from IAccessible, you can then choose how to communicate with the text object. Investigate the Text Services Framework on how to extract text from an application that supports TSF.
精彩评论