Reputation: 345
So, basically I've made a stopwatch GUI application which I want to use for tracking time I spend in front of my PC. I want my stopwatch to stop counting when I lock my PC and resume counting when I unlock my PC. How can this be achieved with Java?
Thanks!
Upvotes: 0
Views: 1809
Reputation: 5486
Hava a look at JNA. They provide an example code to listen to Windows events: https://github.com/twall/jna/blob/master/contrib/native_window_msg/src/com/sun/jna/platform/win32/Win32WindowDemo.java
The example code also includes methods like onMachineLocked
, onMachineUnlocked
which might help you.
Upvotes: 2