zoukankan      html  css  js  c++  java
  • c#判断不按键盘不移动鼠标

    加这个命名空间

    using System.Runtime.InteropServices; 

    [StructLayout(LayoutKind.Sequential)]
    struct LASTINPUTINFO
    {
    [MarshalAs(UnmanagedType.U4)]
    public int cbSize;
    [MarshalAs(UnmanagedType.U4)]
    public uint dwTime;
    }
    [DllImport("user32.dll")]
    static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
    static long GetLastInputTime()
    {
    LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO();
    vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo);
    if (!GetLastInputInfo(ref vLastInputInfo)) return 0;
    return Environment.TickCount - (long)vLastInputInfo.dwTime;
    }

  • 相关阅读:
    模拟测试69
    模拟测试68
    模拟测试66
    NOIP模拟测试15
    NOIP模拟测试14
    Gekoo's checker
    NOIP模拟测试13
    替罪羊树模板
    KDTree笔记
    NOIP模拟测试12
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1509800.html
Copyright © 2011-2022 走看看