Since it's impossible to capture text from a java canvas by using standard Windows API functions like GetMessage()
, I wondered if there is any way to hook the drawText()
method inside such a java canvas and to capture the text before it's actually have been drawn on the canvas. Does anyone have an idea how to solve this? A solution written in java would also be accepted. Any suggestion would be nice, thank you.
Edit:
Is it possible to steal the foreign canvas handle and set it to my own canvas? So the foreign application wouldn't draw anymore to its canvas but to my spoofed one. By this way I could override the drawText()
method easily in my application.
Use Java Instrumentation to inject code into drawString(), for example with Javassist.
You can combine code from here to inject your code with insertBefore
and there to activate the transformation in the premain
method.