Beispiel #1
0
        internal static uint GetIdleTime()
        {
            LastInputInfo lastUserInput = new LastInputInfo();

            lastUserInput.cbSize = (uint)Marshal.SizeOf(lastUserInput);
            GetLastInputInfo(ref lastUserInput);

            return((uint)Environment.TickCount - lastUserInput.dwTime);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 private static extern bool GetLastInputInfo(ref LastInputInfo plii);