Beispiel #1
0
        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);
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
 private static extern bool GetLastInputInfo(ref LastUserInput plii);
Beispiel #4
0
        //Hangi yöntemin kullanılacağı belirleniyor.
        public static IComputerTrace CreateComputerTrace()
        {
            IComputerTrace retVal = new LastUserInput();

            return(retVal);
        }