Hi,
is there any way that I can count the computer inactivity time using a C# program??? If yes can you give some example code??
Thanks,
Anthony
Hi,
is there any way that I can count the computer inactivity time using a C# program??? If yes can you give some example code??
Thanks,
Anthony
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted Sep 3, 2007, 3:12 PM EDT
In .NET 1.1, you could get CPU utilization time for the System Idle Process, which has a process id of 0, using the System.Diagnostics.Process.GetProcessById(0).TotalProcessorTime property.
However, if you try this in .NET 2.0, then for some unknown reason you'll get an 'access denied' exception :(
It's still possible to get this information via the PerformanceCounter class and I'd check out this Code Project article for a discussion of the matter:
http://www.codeproject.com/csharp/processescpuusage.asp