开发者

Get global keyboard input with Java

开发者 https://www.devze.com 2023-02-19 17:57 出处:网络
How can I开发者_运维知识库 get what is being inputed in any program outside my java program.. Is there a way ?

How can I开发者_运维知识库 get what is being inputed in any program outside my java program.. Is there a way ? For example, I'm running my java program then I start typing in notepad, and I can see with my java program what is being typed.


The term you should looking for is Keyboard hooks, here is example using WinApi http://www.codeproject.com/KB/DLL/keyboardhook.aspx


You cannot do this in pure Java. At some point, it will involve talking to an external application or a native library, and will be platform specific in either case.


There is a library to handle native keyboard and mouse control: http://code.google.com/p/jnativehook/

0

精彩评论

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