I don't know a whole lot on the topic, but I imagine that if there was a solution, you're looking at using native code. Windows generates events that should be accessible from languages like C if you know how to find them, but I don't know if it will generate any specific events when the computer is locked
You would need [url=http://java.sun.com/docs/books/tutorial/native1.1/index.html]JNI[/url].
[url=https://jdic.dev.java.net]JDIC [/url] has an incubator project, SystemInfo, this has a [url=https://jdic.dev.java.net/source/browse/jdic/src/incubator/systeminfo/src/share/classes/org/jdesktop/jdic/systeminfo/SystemInfo.java?rev=1.4&view=markup]org.jdesktop.jdic.systeminfo.SystemInfo
.isSessionLocked()[/url] you could poll.
To quote kajbj, why do you need to know that?
hey thansk for those replies.. I will tell you why I need this..
I am writing a chat application for our LAN and ppl can set thrie status just as in Yahoo! Messenger or MSN.. status messages like "I am Busy" "Not at my desk" etc.
Now that Not At my Desk message got me thinking, all of us lock the computer when we leave the desk; so if I know this event, I can automatically set the status in the messenger. Otherwise its taking time for the users to get into the habit :)
Let me know if you have any other solution to this; sure I will take a look at the IBM project.