0

I'd like to write an app in C# (Winforms) that tracks a users time spent on their PC and if they are on it for an hour then tell them to go and have a break.

If they lock the machine then the counter is to be reset, I've seen examples of uptime for the machine and for idle time but nothing for actual time spent working at their PC.

If I can get some pointers as to the best way to accomplish this it would be appreciated. i.e .dll to use or reference etc

Exception
  • 71
  • 1
  • 9
  • 1
    Please don't just ask us to solve the problem for you. Show us how _you_ tried to solve the problem yourself, then show us _exactly_ what the result was, and tell us why you feel it didn't work. See "[What Have You Tried?](http://whathaveyoutried.com/)" for an excellent article that you _really need to read_. – John Saunders Apr 07 '15 at 02:45
  • Hi John, I haven't asked for a solution, I've asked for pointers in the right direction which Craig87762 has done below :-) – Exception Apr 07 '15 at 03:09
  • @JohnSaunders this question is a poor fit for Programmers - it would be quickly voted down and closed over there, see [Green fields, blue skys, and the white board - what is too broad?](http://meta.programmers.stackexchange.com/q/6961/31260) Recommended reading: **[What goes on Programmers.SE? A guide for Stack Overflow](http://meta.programmers.stackexchange.com/q/7182/31260)** – gnat Apr 07 '15 at 21:32
  • Thanks, so what would you suggest for this question? Simply close as too broad? – John Saunders Apr 07 '15 at 21:34
  • @JohnSaunders yes. ["We already tried supporting those questions, we even gave them their own site. Sadly, it didn't work out..."](http://meta.stackexchange.com/a/200144/165773) – gnat Apr 07 '15 at 22:51

1 Answers1

1

You could try using GetLastInputInfo for the idle time and a SessionSwitchEventHandler for the workstation lock/unlock.

Community
  • 1
  • 1
Craig
  • 48
  • 2
  • 6
  • Thanks Craig87762, I guess whilst GetLastInputInfo is recording I could increment a timer of those actions and then when it hits an hour warn the user. Cheers I'll look into it :-) – Exception Apr 07 '15 at 03:14