Search code examples
c#winapic#-2.0accessibilityiaccessible

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 possible 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.


Solution

  • 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?