private IntPtr HookCallback(int nCode, IntPtr wParam, ref KeyboardHookStruct lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode = lParam.vkCode; var keyPressed = KeyInterop.KeyFromVirtualKey(lParam.vkCode); KeyCombinationPressed?.Invoke(keyPressed); } return(CallNextHookEx(hookId, nCode, wParam, ref lParam)); }
/// <summary> /// Called when the combination is pressed /// </summary> /// <param name="e">The key event</param> public void OnKeyCombinationPressed(EventArgs e) { KeyCombinationPressed?.Invoke(this, new CustomEventArgs()); }
public void OnKeyCombinationPressed(EventArgs e) { pauseKeyProcessing = true; KeyCombinationPressed?.Invoke(null, e); }