how to create non window bound keyboard shortcuts

前端 未结 4 1320
故里飘歌
故里飘歌 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:00

    One possible approach would be to use Windows Hooks. But in order to do that you would need to create a native DLL, and in it write your callback function to install as a hook.

    Lookup SetWindowsHookEx for a starting point. There are also lots of online samples on how to use it.

提交回复
热议问题