IdleTimer to have MSN like behaviour in your application

Published 12-24-2005 10:49 PM | Ramon Smits
I've just created a little nice class that helps in building applications that need MSN like behaviour regarding detecting a users idle time. This can be very handy when your application notifies the user for some special event through a non intrusive popup for example. But will the user see this popup when it isn't behind it's computer?

This is where this class comes in. When you detect that the user is idle you stack the notification events until the user is active again to show them to your user.

I have seen bad implementations that use hooks to intercept window messages. But those are real nasty and have impact on system performance. This class uses the GetLastInputInfo api call to ask the system once in a while if there has been user activity. Just take a look at the code by downloading the class IdleTimer.cs.

I have seen some implementations that detect a user idle'ness this way but not a single one also includes an event that get's fired when a user is available again. So that is my UDP (unique download point...).
Filed under:

Comments

# Ramon Smits said on December 24, 2005 1:10 PM:

I posted an article that includes a link to a class file I wrote today that can detect if a user is idle...

# Ramon Smits said on December 24, 2005 1:11 PM:

I posted an article that includes a link to a class file I wrote today that can detect if a user is idle...

# Ramon Smits said on December 25, 2005 2:08 AM:

I posted an article that includes a link to a class file I wrote today that can detect if a user is idle...

# Ramon Smits said on December 25, 2005 3:30 AM:

I posted an article that includes a link to a class file I wrote today that can detect if a user is idle...

# Colin said on December 26, 2005 11:44 PM:

You should zip the IdleTimer.cs or rename it to .txt because an asp.net enabled IIS server will not serve .cs files.

# Ramon Smits said on December 30, 2005 8:56 AM:

I posted an article that includes a link to a class file I wrote today that can detect if a user is idle...