how to create non window bound keyboard shortcuts

前端 未结 4 1291
故里飘歌
故里飘歌 2021-01-23 10:22

I\'m creating a C# application, could be WinForm, but preferably console application, which needs to capture keyboard shortcuts even when the application is not in the foregroun

4条回答
  •  滥情空心
    2021-01-23 11:12

    You should use RegisterHotkey and not a keyboard hook.

    Using a global keyboard hook when you just want a global hotkey is an abuse of the api. It also has negative performance implications since every key needs to be processed by your program before it arrives at the target program.

提交回复
热议问题