private static extern IntPtr SetWindowsHookEx(int idHook, globalKeyboardHook.keyboardHookProc callback, IntPtr hInstance, uint threadId);
public int hookProc(int code, int wParam, ref globalKeyboardHook.keyboardHookStruct lParam) { if (code >= 0) { Keys keyData = (Keys)lParam.vkCode; if (this.HookedKeys.Contains(keyData)) { KeyEventArgs e = new KeyEventArgs(keyData); if ((wParam == 256 || wParam == 260) && _keyDown != null) _keyDown((object)this, e); else if ((wParam == 257 || wParam == 261) && _keyUp != null) _keyUp((object)this, e); if (e.Handled) return 1; } } return globalKeyboardHook.CallNextHookEx(this.hhook, code, wParam, ref lParam); }
private static extern int CallNextHookEx(IntPtr idHook, int nCode, int wParam, ref globalKeyboardHook.keyboardHookStruct lParam);