FMUtils.KeyboardHook 轻量级键盘监听器

Nuget添加引用

Install-Package FMUtils.KeyboardHook

调用示例:

var KeyboardHook = new Hook("Global Action Hook");
KeyboardHook.KeyDownEvent += KeyDown;
// Also: KeyboardHook.KeyUpEvent += KeyUp;

private void KeyDown(KeyboardHookEventArgs e)
{
    // handle keydown event here
    // Such as by checking if e (KeyboardHookEventArgs) matches the key you're interested in
    
    if (e.Key == Keys.F12 && e.isCtrlPressed)
    {
        // Do your magic...
    }
}

 

posted @ 2017-08-07 11:01  巴别塔  阅读(323)  评论(0编辑  收藏  举报