C # Mono - Low Level Keyboard

I am using the code I found on CodeProject.com for a low-level keyboard connection . The only problem is that it uses external DLL calls that do not work in mono. I was wondering if anyone knows how to do the same thing as this code, but will work on both Windows using .net and Linux using mono?

Edit: Clarification of what I'm trying to do: I am making a toolbar, such as an application . The program is in the system tray, and when the user presses a hot key, he gives all the gadgets. Thus, the program has no focus, so usually it will not capture any keystrokes, so I use a low-level keyboard hook, and I connect two keys that the user defines as hot keys. But for this, I use the Windows DLL call, which does not work on Linux using mono. So I wonder if there is a way to do the same, but will work on Linux using mono?

+4
source share
2 answers

It is not possible to get this behavior using only .Net. You must use the binary driver for each platform you are running on (Windows, Linux, Mac OS). It may be possible to use only P / Invoke (to determine which OS you are working on, call the appropriate system libraries) so that you do not have to distribute the "extra" dll / so / dylib.

+3
source

Not knowing what you're trying to capture, it's hard to be sure what works for you. You can see how to use Application.AddMessageFilter.

Example here: http://dn.codegear.com/article/30129

+4
source

Source: https://habr.com/ru/post/1277198/


All Articles