This library is well suited for a tray application.
During alpha development, I ran some tests with RedGate ANTS Performance Profiler. The average memory usage of the demo application was ~250kb, with a peak of 500kb when App/Global hook was swapped - but would return to 250kb upon garbage collection. Small
memory footprint is fine.
All implementations of mouse/keyboard hooks use essentially the same method. That is SetWindowsHookEx and do processing in the HookProc (when callback is received). This library is different from others in how the processing is implemented. Other online
code that I've seen stays with the skeletal basics of how to detect input, but almost nothing more. In this library with several conditionals and thought-out refactoring, it ensures that events are thrown in standard .Net order, double-clicks are thrown with
100% accurately, and provides custom events/event arguments. While the other skeletal code may be marginally faster (i.e. less code) the time saved by the developer by being able to add an event handler for the HookListener and have a fully loaded EventArgs
to work with - is enormous.
Now about the C++ implementation. Again the same basic SetWindowsHookEx method is employed and there will be some gain in raw processing speed. However, there are drawbacks such as a) continuous interop to an unmanaged DLL b) more difficult to maintain c)
if the goal is to provide standard .Net events, C++ isn't well suited. Those are just a few.
Just as an FYI., I'm planning to implement hotkeys (and maybe mouse gestures) in Version 4. This would eliminate your need to use the event handler for KeyDown and check each Keydown that occurs.