How to Detect workstation/System Screen Lock/unlock in windows OS using java?

java, windows

Solution

Use JNI (Java Native Interface) to invoke functions from the Windows system dll.

Here is the sample code for use of functions which check workstation locking state: http://brutaldev.com/post/2008/05/23/Checking-if-the-workstation-is-locked.aspx

And here is the article about invoking dll-functions from Java via JNI: http://edn.embarcadero.com/article/20679

Problem

I'm trying to note down workstation/System screen Lock and Unlock of each employee working in windows OS. I needed to store these record in a DataBase, using JAVA. I have searched all over and got on idea how to do it using JAVA. where ever I searched I get code for VB only.

Original source