I know it's possible to send keystrokes in java using Robot Class , but is there any way to specify the target process when it's already started ?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The Robot will send the keystrokes to whichever application window is on top. To send keystrokes to a specific target, you will want to set the target as the platform's foreground window first. Doing this may require native code such as that provided by JNI or (what I use) JNA. If you desire to send keystrokes to a background window, I believe that you cannot use Robot, that you will have to write native code. Of course all native code solutions will be platform dependent.
You ask:
For Windows, you would interface with the user32.dll library. Something like this has worked for me:
User32.java
JnaUtil.java
JnaUtilException.java