我正在寻找一种在Java应用程序中知道的方法(没有 JNI - 它是一个多平台应用程序)可以检测屏幕是否被锁定。
I'm looking for a way to know in a Java application (without JNI - it's a multi-platform application) can detect if the screen is locked.
有关信息...我们的应用程序记录用户工作时间 - 我们希望它在屏幕被锁定时自动停止录制而不是用户必须明确地停止录制。
For information... our application records time while a user is working - we want it to automatically stop recording when the screen is locked instead of the user having to do so explicitly.
推荐答案我认为没有一个API,甚至没有办法做到这一切。解析java.awt.Robot生成的屏幕截图既不是平台也不是版本甚至是配置独立的,一般来说,我不认为屏幕被锁定是一个足够明确的概念,在这个意义上使用 - 在Linux上,可以有不止一个屏幕(X服务器),你可以切换到控制台终端,你可以让运行一台(或多台)机器的应用程序通过网络在另一台机器上显示它们的GUI ...
I don't think there is an API for that or even a way to do it all. Parsing screenshots generated by java.awt.Robot is neither platform- nor version- or even configuration-independant, and in general, I don't think "screen is locked" is a well-enough defined concept to be used in this sense - on Linux, there can be more than just one "screen" (X server), you can switch to console terminals, you can have applications running one (or more) machines display their GUIs on another machine over the network...
更多推荐
有没有办法让Java应用程序检测屏幕是否被锁定?
发布评论