Reputation: 24506
I'm looking for a way able to detect the text where the mouse pointer is, for whatever standard Windows app (IE, Firefox, Word, Notepad etc) the user is using at present. Is this possible ? (It's not for evil purposes, honest!). I've tried Googling and searching SO, but haven't got anything useful so far.
Upvotes: 1
Views: 664
Reputation: 23214
Depending on what you point at, it can work in some cases.
eg. you could get the underlying window handle (hwnd) and send wm_gettext to it and you might get what you want back. (e.g. text on buttons, textboxes, some labels etc)
however, it will not do what you want if you point somehwere on a browser page or so..
Meh, CodeInChaos beat me to it..
Upvotes: 2
Reputation: 108790
A few ideas:
I'd try pursuing the accessibility idea.
Upvotes: 2
Reputation: 3043
You could take a screen shot, then use OCR to translate the image to text. I think you can query the OS for the mouse cursor position, then correlate where it is in the image.
Not a good solution, but it gives you something.
Upvotes: 0
Reputation: 22492
No, it's not possible -- at least not in a general way. The only possibility is to query the application that put the text on the screen, in essence asking it "what did you put at this location?"
Upvotes: 0