I am writing a c# Winform application and I need to close session if the computer is idle for 5 seconds. The application is like a restaurant application, when the waiter leaves his session open, I will close it after 5 seconds.
I found some code but I dont know how to use it and how to trigger it
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
internal struct LASTINPUTINFO
{
public uint cbSize;
public uint dwTime;
}
Can anybody help me with this?