I'm writing a small tray application that needs to detect the last time a user interacted with their machine to determine if they're idle.
Is there any way to retrieve the time a user last moved their mouse, hit a key or interacted in any way with their machine?
I figure Windows obviously tracks this to determine when to display a screen saver or power down, etc, so I'm assuming there's a Windows API for retrieving this myself?
GetLastInputInfo. Documented at PInvoke.net.