开发者

Get text selection with IAccessible

开发者 https://www.devze.com 2023-02-13 10:00 出处:网络
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 us

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号