开发者

Get current active line of text?

开发者 https://www.devze.com 2022-12-09 14:53 出处:网络
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 an

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.

0

精彩评论

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

关注公众号