windows - How to hook hotkeys in winforms or WPF from a .NET 2.0 assembly? -


I have an assembly that targets .NET 2.0 to be compatible with a wide range of applications. When used with desktop applications (either Winforms or WPF) I want to hook up some hotkeys and popup models to the dialog window. The hard bit is a solution that can be implemented under .NET 2.0 which is compatible with WPF.

For Winforms, I can use or implement a message filter and hook into the method, but they do not work properly WPF.

For WPF, the class is great, but it is not available in .NET 2.0.

An ideal solution would be:

  • Hook keystrokes for either WPF or Winforms

  • Provide the application wide, no system-wide scope

You can create a universal solution based on Windows API (system wide hook). Don Esposito has written a great article on that here. Here is a link.

You can also write an application hook if you do not want to hook the system wide it actually apply Don is also easy, which is what I think.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -