* create a new WPF Application
* add a reference to System.Runtime.InteropServices
* add a public static class called "hook.cs"
* in App.xaml.cs add a static variable to buffer the hook result code
public static int hHook =0 ;
* in hook.cs add the namespace System.Runtime.InteropServices
* in hook cs add a static public method called Register() and save the hook value in the hHook of App.xaml.cs
* in hook.cs add a static public method called Unregister()
* in hook.cs add a static method as the MouseProcedure to handle the global messages
* in hook.cs add 2x Imports to register, unregister the hook and add 1x Import to pass the hook-Event. (DllImport user32.dll)
* in hook.cs -> MouseProcedure reacts on the mouseclick signal WM_LBUTTONDOWN
* register the hook in the startup of the application through calling the static method register() of the class in the hook.cs
* by leaving the application unregister such hook again through the appropriate method in hook.cs
download the short sample project here and check it in detail!
(based on http://www.codeproject.com/Articles/17969/Mouse-Operations)
Benefit from the best Windows Desktop app in the world and use Strokey.Net!
Keine Kommentare:
Kommentar veröffentlichen