锁定键盘、鼠标 武胜

//declare this
using System.Runtime.InteropServices;
 
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern void BlockInput([In, MarshalAs(UnmanagedType.Bool)]bool fBlockIt);
 

private void button1_Click(object sender, EventArgs e)
{
    BlockInput(true);
 BlockInput(false);
}
原文地址:https://www.cnblogs.com/zeroone/p/2687554.html