Search code examples
c#windowswinapigoogle-chromeaccessibility

Get caret position in non-GDI apps


So I'm writing an accesibility app that needs to know the location of the text entry caret. I tried GUIThreadInfo, but while that works in basic apps like Notepad, it fails in more complex ones like Chrome, iTunes, etc. that handle their own UI.

Is there even a way to get the caret position from apps like this?


Solution

  • Yes, doesn't work. The caret is an implementation detail of user32, associated with a window. Applications like browsers don't use window controls, far too expensive. And they don't have to, there's a separate API to allow such programs to provide an interface to accessibility apps like screen readers. Start reading here.