Java application to be triggered by key sequence in windows
Is it possible to "screen" every key pressed by the user and search for the s开发者_运维知识库tring that opens the java program? I hope to create a fun application that upon detecting the string "Open sesame" to trigger a window in my program to pop-up. Can this be done with java?
EDIT: The string that triggers the program is listened for system-wide. I'm also wondering wether the use of win-api hooks would be appropriate for this.
You can't technically do this in java as java runs in a virtual machine and the actual key buffering occurs at a bios level (filling the keyboard type ahead buffer i mean). You need lower level access than java can provide. There may be work arounds but in general you can't use a language with managed code to do this kind of thing. I have hooked into those api's with C# so maybe that is a possibility with java too but why not just do it in c++/c then.
I would look into a Key Listener.
精彩评论