I would like to get the idle time of my Windows Forms application (not the system). This will enable me to update the database to show which users are online/offline amongst other things.
I have searched extensively here, googled, and have come up empty handed.
The way to me is to monitor for mouse and keyboard events and update some static variable, see. I’m not sure if you need to go so deep to Win32 calls, maybe you’ll be just fine with standard .NET events.
As Hans Passant noted you can use
Application.Idlestatic event. However be sure to deattach it inApplication.Exitevent, to avoid memory leaks.P.S. for C# to VB.NET translation you can use this.