Get current active line of text?
I want to g开发者_JAVA百科et text from current active line (the line where the caret is) from any text editor that is currently in focus. My program that will get that text is working in background and doesn't have a GUI. How to get that line of text?
What you're asking for is impossible. Its easy to prove since programs can define their own controls and what windows messages to handle (or not handle at all!). The only thing you can really do is something like this. It may work for some text editors who will respond to the WM_GETTEXT message, but you're likely to get nothing or everything. If you're targetting a specific editor, they may have something publically defined to get a piece of text, but you're going to have lots of trouble getting something to work for every possible Windows text input control.
精彩评论