Get Total Idle Time 
Author Message
 Get Total Idle Time

I know variations of this post exists, but my issue is a little more
specific.  I want to get the total idle time of the user, like the AIM
idle timer.  I'm using it to log out the user of my program (not
windows login) after he/she is idle after x minutes.  What's the
simplest way?

The only way I can think of is to use the Application.Idle event to
keep the current tick time.  Increment the tick time if the last tick
time is within a couple ticks, otherwise restart the tick count
sequence.  Once the tick has been increments x minutes, then run the
log out procedure.

Any advise would be greatly appreciated! Thank you in advance!

gKc



Tue, 08 Mar 2005 16:08:43 GMT  
 Get Total Idle Time
gKc, your approach will give you the idle time for your current application,
not the idle time for your user on Windows.  For instance, if your app is
minimized and the user is doing something in another app, your app will
still count that as idle time.  One way to get real system idle time is to
install system hooks on the Mouse and Keyboard.  Whenever an event comes
through your hooks you can reset your idle flag because the user must have
done something.  Unfortunately, it doesn't seem possible to write a system
hook in C#, you'll have to delve into C++.  Check out this NG post for more
info and sample code.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3...
fc16%24c2157230%242ae2c90a%40hosting.microsoft.com

--
Greg
http://www.claritycon.com/



Quote:
> I know variations of this post exists, but my issue is a little more
> specific.  I want to get the total idle time of the user, like the AIM
> idle timer.  I'm using it to log out the user of my program (not
> windows login) after he/she is idle after x minutes.  What's the
> simplest way?

> The only way I can think of is to use the Application.Idle event to
> keep the current tick time.  Increment the tick time if the last tick
> time is within a couple ticks, otherwise restart the tick count
> sequence.  Once the tick has been increments x minutes, then run the
> log out procedure.

> Any advise would be greatly appreciated! Thank you in advance!

> gKc



Tue, 08 Mar 2005 21:38:15 GMT  
 Get Total Idle Time
Thanks Greg for you reply! I'm afraid I was a bit unclear, I do want
the idle time of the application.  Thanks again!
Quote:

> gKc, your approach will give you the idle time for your current application,
> not the idle time for your user on Windows.  For instance, if your app is
> minimized and the user is doing something in another app, your app will
> still count that as idle time.  One way to get real system idle time is to
> install system hooks on the Mouse and Keyboard.  Whenever an event comes
> through your hooks you can reset your idle flag because the user must have
> done something.  Unfortunately, it doesn't seem possible to write a system
> hook in C#, you'll have to delve into C++.  Check out this NG post for more
> info and sample code.

> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3...
> fc16%24c2157230%242ae2c90a%40hosting.microsoft.com

> --
> Greg
> http://www.claritycon.com/



> > I know variations of this post exists, but my issue is a little more
> > specific.  I want to get the total idle time of the user, like the AIM
> > idle timer.  I'm using it to log out the user of my program (not
> > windows login) after he/she is idle after x minutes.  What's the
> > simplest way?

> > The only way I can think of is to use the Application.Idle event to
> > keep the current tick time.  Increment the tick time if the last tick
> > time is within a couple ticks, otherwise restart the tick count
> > sequence.  Once the tick has been increments x minutes, then run the
> > log out procedure.

> > Any advise would be greatly appreciated! Thank you in advance!

> > gKc



Wed, 09 Mar 2005 10:23:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Getting idle time of system/os

2. How to obtain the login time and the idle time of the user

3. how to obtain the login time and the idle time of the users

4. How to get system idle time or get notified after the system being idle for an extended time

5. total newbie is getting shit from compiler!

6. Getting the total of columns in a listview???

7. URGENT : Getting Total Local Drives

8. How to get system idle time or get notified after the system being idle for an extended time

9. Getting total RAM, ROM, Processor Type and Clock

10. the total time a person is in the Machine

11. System Idle time

12. Idle Times

 

 
Powered by phpBB® Forum Software