internal static uint GetIdleTime() { LastInputInfo lastUserInput = new LastInputInfo(); lastUserInput.cbSize = (uint)Marshal.SizeOf(lastUserInput); GetLastInputInfo(ref lastUserInput); return((uint)Environment.TickCount - lastUserInput.dwTime); }
internal static long GetLastInputTime() { LastInputInfo lastUserInput = new LastInputInfo(); lastUserInput.cbSize = (uint)Marshal.SizeOf(lastUserInput); if (!GetLastInputInfo(ref lastUserInput)) { throw new Exception(GetLastError().ToString()); } return(lastUserInput.dwTime); }
private static extern bool GetLastInputInfo(ref LastInputInfo plii);