How specifically does one detect that a user is idle on Windows 7?

谁都会走 提交于 2019-12-07 21:57:06

问题


Given that Outlook runs in most offices, and given that a screensaver may user CPU, or network file copies, or virus scans, or network installs by the admin (granted, that usually happens when you're logged out), and all the myriad other things that might occur on a Windows 7 desktop in an office environment, how could I possibly know that a user is idled out, and not just reading a PDF?

Do I use a set of metrics to sample at regular intervals and use that to determine "away" or do I need to monitor some file, is there a API that should be exposed?

I can't rely on screensavers being active, or the computer entering a specific power state, and I'm not sure what is exactly off-limits, but I also don't know what's on-limits, as it were.


回答1:


I think you're looking for GetLastInputInfo, which tells you how long it's been since the user hit a key on the keyboard or wiggled the mouse (or touched a touch-enabled screen?).



来源:https://stackoverflow.com/questions/15929790/how-specifically-does-one-detect-that-a-user-is-idle-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!