Is there a way to set focus to a non-java application running in WindowsXP?
807588Jul 17 2009 — edited Jul 17 2009Hi,
I am spawning a non-java application from within my Java application using Runtime.getRuntime().exec(...). Based on user interaction within my Java application, I need to send input to the external application. The external application will not respond to the standard getOutputStream methods, but it will respond to the Robot.keyPress event. However, the Robot.keyPress event only works if the external application has focus, which is impossible if the user is interacting with my Java program.
Is there any way to set focus to an existing external non-Java window application from within Java? I would rather not use the Robot mouse press events because I won't know where the external application is within the desktop. I realize that the external application gets focus when it is first created, but that doesn't help me.
Thanks for any ideas,
Alan