代码
C#
private LASTINPUTINFO lastInputInfo = new LASTINPUTINFO();private void InitLastInputInfo(){ lastInputInfo.cbSize = (uint)Marshal.SizeOf(typeof(LASTINPUTINFO));}private uint GetLastInputInfo(){ bool res = GetLastInputInfo(ref lastInputInfo); if (res) { return (uint)Environment.TickCount - lastInputInfo.dwTime; } return 0;}[DllImport("user32.dll")]private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);[StructLayout(LayoutKind.Sequential)]struct LASTINPUTINFO{ public uint cbSize; public uint dwTime;
支付宝微信扫一扫,打赏作者吧~
