public void ReceiveMessageEvent(WindowMessageReceivedArgument e)
 {
     if (e.Message == Message.WM_HOTKEY && (int)e.WordParameter == hotkeyInterception.InterceptionId)
     {
         HandleHotkeyMessage();
     }
 }
예제 #2
0
 void HandleHotkeyMessage(WindowMessageReceivedArgument e)
 {
     var interception = GetInterceptionForInterceptionId((int)e.WordParameter);
     if(interception != null && HotkeyFired != null)
     {
         HotkeyFired(this, new HotkeyFiredArgument(
             interception.KeyCode, interception.ControlNeeded));
     }
 }
예제 #3
0
        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)
            {
                if (shouldSkipNext)
                {
                    logger.Information("Clipboard update message skipped.");

                    shouldSkipNext = false;
                    return;
                }

                HandleClipboardUpdateWindowMessage();
            }
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
        IntPtr WindowHookCallback(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (Enum.IsDefined(typeof(Message), msg))
            {
                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;
        }