Ejemplo n.º 1
0
 /// <summary>
 /// Override the callback function handling the events so we can return wether or not the event has been handled
 /// </summary>
 protected int OverrideCallBackFunction(int code, IntPtr wParam, IntPtr lParam)
 {
     if (code == 0) // Win32.HC_ACTION
     {
         if (HandleHookEvent(wParam, lParam))
         {
             return(1); // The event has been handled
         }
     }
     return(Win32Api.CallNextHookEx(InternalHook, code, wParam, lParam));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Override the callback function handling the events so we can return wether or not the event has been handled
 /// </summary>
 private int ThisCallBackFunction(int code, IntPtr wParam, IntPtr lParam)
 {
     if (code >= 0)
     {
         if (GetCode != null)
         {
             GetCode((Win32Api.HCBT)code);
         }
     }
     return(Win32Api.CallNextHookEx(InternalHook, code, wParam, lParam));
 }
Ejemplo n.º 3
0
        // Default filter function
        protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return(Win32Api.CallNextHookEx(InternalHook, code, wParam, lParam));
            }

            // Let clients determine what to do
            OnHookInvoked(new HookEventArgs {
                HookCode = code,
                WParam   = wParam,
                LParam   = lParam
            });

            // Yield to the next hook in the chain
            return(Win32Api.CallNextHookEx(InternalHook, code, wParam, lParam));
        }