Reputation: 4968
Is there anything that provides a system-wide last user input information? We want to use C# to get the idle time for the system across all sessions and put the machine to sleep if nobody is using the machine for X minutes.
It appears that GetLastInputInfo is user specific. http://msdn.microsoft.com/en-us/library/ms646302(VS.85).aspx
Upvotes: 1
Views: 3575
Reputation: 138915
You can use the Windows Task Scheduler and register a Task that's launched when the system is idle. That's the best way, as it's no so obvious to determine the idleness of a system (check out the article at least to get a grasp of what it means). You can also protect task using security, etc. See here for more information on this: Task Idle Conditions
To program the task scheduler in C#, you can use various wrapper. Here is at least one: Task Scheduler Managed Wrapper
Upvotes: 3