2

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.

Joe
  • 41,484
  • 20
  • 104
  • 125
jcolebrand
  • 15,889
  • 12
  • 75
  • 121
  • related: http://stackoverflow.com/questions/15852597/using-node-js-os-cpus-to-detect-user-idle-time – jcolebrand Apr 10 '13 at 15:13
  • 1
    What exactly do you mean by "idle"? I guess it depends on what you intend to do when the user is "idle". From the computer's perspective there's no difference between "the user isn't present at the machine" and "the user hasn't provided any input for a while". – Luke Apr 10 '13 at 15:27
  • also related (in fact a possible dupe): http://stackoverflow.com/questions/2212823/how-to-detect-inactive-user – Adrian McCarthy Apr 10 '13 at 15:43
  • @Luke excellent question, that was why I provided the related. I'm trying to generalize their question to be more specific to a OS and less specific to a language (as bindings can be written from to on nearly anything) – jcolebrand Apr 10 '13 at 16:43
  • @Martin thanks for the edit, I didn't click python-idle off that list of idles, so ... go figure tag editor ... – jcolebrand Apr 10 '13 at 17:14

1 Answers1

4

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?).

Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175