Question

I'm actually working on an screenshot saver on Windows, and i'd like to call to a method on the java application when I press a combination of keys to save the screen.

How can I call a method when the java application is not the "active" window? whether the main window is minimized or is running on background.

Was it helpful?

Solution

You're looking for a Hook in your keyboard for Windows. Note that hooking is highly relevant to the OS and your application may not be portable between different versions/editions of the OS. Still, you can do this using JNA as shown here: JNA Keyboard Hook in Windows or using a third party library like jnativehook.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top