I have a Java background so have limited knowledge when it comes to C# and C++. Basically I am trying to "read" text from another application which is displayed on screen...
To be specific, I want to read the dealer chat message from Pokerstars... on the fly...
What is the best way to read this text into a Java program on the fly? Ive head about API hooking, is this the only way and how would I do this in Java?
Thanks Phil
One way to do it, which works as long as text is not anti-aliased, like in your image:
From your application, take a screenshot of the other application's window. Search the screenshot for all non-white pixels. Make a list of all the non-white pixels. For each pair of non-white pixels in the list, if the pair touches each other, put them in the same "group." Do this until all the pixels are grouped together.
Then for each group, compare its shape to a table of predefined shapes. If the shape isn't in the table, ask the user to type the letter, then save the shape and which letter it is to the table.
Now you have ASCII codes for all the letters in the window.
This is not the cleanest way to scrape text from a window, but it is hard to defeat. For any move made by the other application to make the text harder to read by a computer, it will become harder to read by a human, which lowers the usefulness of the application.