private static long GetNoMouseOrKeyboardOpTime() { PLASTINPUTINFO lastInputInfo = new PLASTINPUTINFO(); lastInputInfo.cbSize = Marshal.SizeOf(lastInputInfo); if (!GetLastInputInfo(ref lastInputInfo)) { return(0); } return(Environment.TickCount - lastInputInfo.dwTime); }
static extern bool GetLastInputInfo(ref PLASTINPUTINFO plii);