/// <summary> /// Get the Last input time in ticks /// </summary> /// <returns></returns> public static long GetLastInputTimeInTicks() { NativeMethods.LASTINPUTINFO lastInPut = new NativeMethods.LASTINPUTINFO(); lastInPut.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(lastInPut); if (!NativeMethods.GetLastInputInfo(ref lastInPut)) { throw new Exception(NativeMethods.GetLastError().ToString()); } return(lastInPut.dwTime); }