锁定键盘、鼠标

//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);

}

你可能感兴趣的:(键盘)