Beispiel #1
0
 protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
 {
     if (code < 0 || this.OnHookInvoked(new HookEventArgs(code, wParam, lParam)))
     {
         return(WindowsHook.CallNextHookEx(this.hook, code, wParam, lParam));
     }
     return(code);
 }
Beispiel #2
0
 public void Install()
 {
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         using (ProcessModule mainModule = currentProcess.MainModule)
             this.hook = WindowsHook.SetWindowsHookEx(this.hookType, this.hookFunc, WindowsHook.GetModuleHandle(mainModule.ModuleName), 0);
     }
 }
Beispiel #3
0
 public void Uninstall()
 {
     WindowsHook.UnhookWindowsHookEx(this.hook);
     this.hook = IntPtr.Zero;
 }