public void ReceiveMessageEvent(WindowMessageReceivedArgument e) { if (e.Message == Message.WM_HOTKEY && (int) e.WordParameter == hotkeyInterception.InterceptionId) { HandleHotkeyMessage(); } }
private void HandleHotkeyMessage(WindowMessageReceivedArgument e) { if (!isInstalled) return; var interception = GetInterceptionForInterceptionId((int) e.WordParameter); if (interception != null) { HotkeyFired?.Invoke(this, new HotkeyFiredArgument( interception.KeyCode, interception.ControlNeeded)); } }
public void ReceiveMessageEvent(WindowMessageReceivedArgument e) { switch (e.Message) { case Message.WM_SHOWWINDOW: userInterfaceThread.Invoke(() => HandleWindowVisibilityChangedMessage(e)); break; case Message.WM_HOTKEY: HandleHotkeyMessage(e); break; } }
public void ReceiveMessageEvent(WindowMessageReceivedArgument eventArgument) { if (eventArgument.Message != Message.WM_CLIPBOARDUPDATE) return; if (shouldSkipNext) { logger.Information("Clipboard update message skipped."); shouldSkipNext = false; return; } HandleClipboardUpdateWindowMessage(); }
private void HandleWindowVisibilityChangedMessage(WindowMessageReceivedArgument e) { const int Shown = 1; const int Hidden = 0; switch ((int) e.WordParameter) { case Shown: Install(e.WindowHandle); break; case Hidden: Uninstall(); break; } }
private IntPtr WindowHookCallback(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (!Enum.IsDefined(typeof (Message), msg)) return IntPtr.Zero; logger.Information($"Message received: [{hwnd}, {FormatMessage((Message) msg)}, {wParam}, {lParam}]"); var argument = new WindowMessageReceivedArgument(hwnd, (Message) msg, wParam, lParam); pendingMessages.Enqueue(argument); consumerLoop.Notify(HandleNextMessageAsync, cancellationTokenSource.Token); return IntPtr.Zero; }