锁定键盘、鼠标

//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);
}
posted on 2012-09-16 15:15  武胜-阿伟  阅读(239)  评论(0编辑  收藏  举报