开发者

Java Robot for background (inactive) windows?

In Java, is it possible to use the Robot class to simulate开发者_开发百科 keypresses to a Java window that is inactive (aka, that has been minimized to the background)?


No, that's not possible.

Robot class is just a handle of the mouse and keyboard ( among others ) and doesn't have special privileges over another Java application ( the same way it doesn't have any privileges over a non java application )

If you need to do this and you have the source code of your application, you can add support for that application and listen external applications.

If you don't have the source code and still need this behavior another possibility ( depending on what you need to do ) is to install a virtual machine ( like VMWare ) and run the program there, and have that VM minimized.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜