So you want to have an application that
a) scans all the running processes
b) for an identified subset of those, determine how long each has been
"idle"
c) stop those whose idle time exceeds a threshold and
d) inform the user you have done so with a friendly message.
A pretty puzzle, and I hope some guru or other can help you.
I found some interesting stuff in System.Diagnostics.Process. If I am
reading that correctly, you can find the processes and their names (a).
You can find their state (e.g. idle in ProcessPriorityClass), but I don't
see an idle time in that class.
If you had a thread that checked the state every few seconds... but the
problem I see is that it may have gone un-idle and back to idle in the
interim. I suppose you could check resource usage -- TotalProcessorTime --
and if it is unchanged for the time period...
In any case,
Good Luck!
"Jim G" <jg****@williamblair.com> wrote in message
news:e5**************************@posting.google.c om...
Hi,
We have a limited number of licenses to some software we have
installed on our users desktops. The problem is that sometimes the
users open up the application and then don't use it all day. This
prevents others from being able to use the application because we run
out of licenses.
I'm thinking that we want to create a windows service using VB.Net
that we will run on everyone's machine and have it monitor this
application to see if it is idle for too long. If it is idle for too
long, we will then kill it and pop up a message to the users letting
them know what we did. Does anyone have any ideas? Any sample code?
Thanks!