FMUtils.KeyboardHook 輕量級鍵盤監聽器

Nuget添加引用spa

Install-Package FMUtils.KeyboardHook

調用示例:rest

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...
    }
}
相關文章
相關標籤/搜索