private static int GetIdleTime() { LastUserInput LastUserAction = new LastUserInput(); LastUserAction.cbSize = (int)System.Runtime.InteropServices.Marshal.SizeOf(LastUserAction); GetLastInputInfo(ref LastUserAction); return((int)Environment.TickCount - LastUserAction.dwTime); }
/// <summary> /// Returns milliseconds since last user action, i.e. how long they've been idle /// </summary> /// <returns>User idle time in milliseconds</returns> public static uint GetIdleMilliseconds() { var lastUserInput = new LastUserInput(); lastUserInput.StructSize = (uint)Marshal.SizeOf(lastUserInput); GetLastInputInfo(ref lastUserInput); return((uint)Environment.TickCount - lastUserInput.LastActivityMillisecond); }
private static extern bool GetLastInputInfo(ref LastUserInput plii);
//Hangi yöntemin kullanılacağı belirleniyor. public static IComputerTrace CreateComputerTrace() { IComputerTrace retVal = new LastUserInput(); return(retVal); }