Not likely as I don't know C++ nor care to learn about it.
AHK uses win32 api's GetCaretPos to obtain caret position, before using the function, it attaches input between the script thread and the foreground window's thread. Check the AHK source code for more details.ACC would be the only method as there is acc.ahk noone will develop XPCOM or something else. If you find a solution post it, I'm sure I won't be able to find it ...
possible solution for Firefox:
(4) using Last-mouse-click position + helper window
Me too. I'm a Python programmer, not so skilled in C++. I stopped tackling this problem after realizing my limitation. Post a message here, hopefully someone else can find it from the Search.
forgot to add
(5) I noticed Firefox uses WM_PAINT to draw/redraw its window, perhaps when the caret is blinking , it's possible to hook BeginPaint function, and check the rcPaint parameter in the output. It may reveal the caret coordinates.