protected void RaiseHookInvoked(HookEventArgs e) { HookEventHandler temp = HookInvoked; if (temp != null) { temp(this, e); } }
/// <summary> /// General Hook hadling function, only raises event with hook's parameters /// </summary> /// <param name="code">Specifies the hook code passed to the current hook procedure.</param> /// <param name="wParam">Specifies the hook wParam passed to the current hook procedure.</param> /// <param name="lParam">Specifies the hook lParam passed to the current hook procedure.</param> /// <returns>The value returned by CallNextHookEx function</returns> protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam) { // According to Platform SDK we must return the value returned by CallNextHookEx if (code < 0) { return(CallNextHookEx(hhook, code, wParam, lParam)); } // Raise HookInvoked event HookEventArgs e = new HookEventArgs(); e.HookCode = code; e.wParam = wParam; e.lParam = lParam; RaiseHookInvoked(e); // Call the next hook in the chain return(CallNextHookEx(hhook, code, wParam, lParam)); }
protected void RaiseHookInvoked(HookEventArgs e) { HookEventHandler temp = HookInvoked; if ( temp != null ) temp(this, e); }
/// <summary> /// General Hook hadling function, only raises event with hook's parameters /// </summary> /// <param name="code">Specifies the hook code passed to the current hook procedure.</param> /// <param name="wParam">Specifies the hook wParam passed to the current hook procedure.</param> /// <param name="lParam">Specifies the hook lParam passed to the current hook procedure.</param> /// <returns>The value returned by CallNextHookEx function</returns> protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam) { // According to Platform SDK we must return the value returned by CallNextHookEx if (code < 0) return CallNextHookEx(hhook, code, wParam, lParam); // Raise HookInvoked event HookEventArgs e = new HookEventArgs(); e.HookCode = code; e.wParam = wParam; e.lParam = lParam; RaiseHookInvoked(e); // Call the next hook in the chain return CallNextHookEx(hhook, code, wParam, lParam); }