Beispiel #1
0
 public MouseHookEventArgs(IntPtr handle, WindowsMessage windowsMessage, int x, int y)
 {
     Handle         = handle;
     WindowsMessage = windowsMessage;
     X = x;
     Y = y;
 }
        private IntPtr WindowProcedure(IntPtr hwnd, WindowsMessage msg, IntPtr wParam, IntPtr lParam)
        {
            switch (msg)
            {
            case WindowsMessage.Destroy:
                return((IntPtr)0);

            case WindowsMessage.Erasebkgnd:
                User32.SendMessage(WindowHandle, WindowsMessage.Paint, (IntPtr)0, (IntPtr)0);
                break;

            case WindowsMessage.Keydown:
                return((IntPtr)0);

            case WindowsMessage.Paint:
                return((IntPtr)0);

            case WindowsMessage.Dwmcompositionchanged:     // needed for windows 7 support
                ExtendFrameIntoClientArea();
                return((IntPtr)0);

            case WindowsMessage.DpiChanged:
                return((IntPtr)0);    // block DPI Changed message

            default: break;
            }

            return(User32.DefWindowProc(hwnd, msg, wParam, lParam));
        }
        /// <summary>
        ///     Helper Method to get the IHTMLDocument2
        /// </summary>
        /// <param name="mainWindow"></param>
        /// <returns></returns>
        private static IHTMLDocument2 GetHtmlDocument(IInteropWindow mainWindow)
        {
            var ieServer = "Internet Explorer_Server".Equals(mainWindow.GetClassname())
                                ? mainWindow
                                : mainWindow.GetChildren().FirstOrDefault(window => window.GetClassname() == "Internet Explorer_Server");

            if (ieServer == null)
            {
                Log.Warn().WriteLine("No Internet Explorer_Server for {0}", mainWindow.Text);
                return(null);
            }

            var windowMessage = WindowsMessage.RegisterWindowsMessage("WM_HTML_GETOBJECT");

            if (windowMessage == 0)
            {
                Log.Warn().WriteLine("Couldn't register WM_HTML_GETOBJECT");
                return(null);
            }

            Log.Debug().WriteLine("Trying WM_HTML_GETOBJECT on {0}", ieServer.Classname);
            if (User32Api.TrySendMessage(ieServer.Handle, windowMessage, IntPtr.Zero, out UIntPtr response))
            {
                var document2 = (IHTMLDocument2)Accessible.ObjectFromLresult(response, typeof(IHTMLDocument).GUID, IntPtr.Zero);
                if (document2 != null)
                {
                    return(document2);
                }
                Log.Error().WriteLine(null, "No IHTMLDocument2 found");
                return(null);
            }
            Log.Error().WriteLine(null, "No answer on WM_HTML_GETOBJECT.");
            return(null);
        }
Beispiel #4
0
			public MouseHookEventArgs(IntPtr handle, WindowsMessage windowsMessage, int x, int y)
			{
				Handle = handle;
				WindowsMessage = windowsMessage;
				X = x;
				Y = y;
			}
Beispiel #5
0
			public MouseHookEventArgs(IntPtr handle, WindowsMessage windowsMessage, POINT point)
			{
				Handle = handle;
				WindowsMessage = windowsMessage;
				X = point.x;
				Y = point.y;
			}
        private IntPtr WindowProcedure(IntPtr hwnd, WindowsMessage msg, IntPtr wParam, IntPtr lParam)
        {
            switch (msg)
            {
            case WindowsMessage.WM_DESTROY:
                return((IntPtr)0);

            case WindowsMessage.WM_ERASEBKGND:
                User32.SendMessage(WindowHandle, WindowsMessage.WM_PAINT, (IntPtr)0, (IntPtr)0);
                break;

            case WindowsMessage.WM_KEYDOWN:
                return((IntPtr)0);

            case WindowsMessage.WM_PAINT:
                return((IntPtr)0);

            case WindowsMessage.WM_DWMCOMPOSITIONCHANGED:     // needed for windows 7 support
                ExtendFrameIntoClientArea();
                return((IntPtr)0);

            default: break;
            }

            if ((int)msg == 0x02E0) // DPI Changed
            {
                return((IntPtr)0);  // block DPI Changed message
            }

            return(User32.DefWindowProc(hwnd, msg, wParam, lParam));
        }
Beispiel #7
0
 public MouseHookEventArgs(IntPtr handle, WindowsMessage windowsMessage, POINT point)
 {
     Handle         = handle;
     WindowsMessage = windowsMessage;
     X = point.x;
     Y = point.y;
 }
Beispiel #8
0
        static uint messageProc(uint Message, IntPtr wParam, IntPtr lParam)
        {
            WindowsMessage wm = (WindowsMessage)Message;

            Trace.TraceInformation($"WM {wm}: wParam: {string.Format("{0:X8}", wParam.ToInt32())}, lParam: {string.Format("{0:X8}", lParam.ToInt32())}");
            return(1);
        }
Beispiel #9
0
        private (bool, long) OnWndProc(WindowsMessage msg, ulong wParam, long lParam)
        {
            // Notify all the inlays of the wndproc, respond with the first capturing response (if any)
            // TODO: Yeah this ain't great but realistically only one will capture at any one time for now. Revisit if shit breaks or something idfk.
            var responses = inlays.Select(pair => pair.Value.WndProcMessage(msg, wParam, lParam));

            return(responses.FirstOrDefault(pair => pair.Item1));
        }
Beispiel #10
0
        private void SendMouseMessageToMainWindow(WindowsMessage msg, MouseState wParam, int x, int y)
        {
            Message m = new Message();

            m.Msg    = (int)msg;
            m.WParam = (IntPtr)wParam;
            m.LParam = (IntPtr)(x | y << 16);
            m.HWnd   = this.m_Host.Handle;
            this.SendMouseMessageToMainWindow(m);
        }
        private void Hook_OnHookCalled(IntPtr wParam, IntPtr lParam)
        {
            if (lParam == IntPtr.Zero)
            {
                return;
            }

            if (ClearInjectedFlag)
            {
                int flags = Marshal.ReadInt32(lParam + 8);

                BitArray bits = new BitArray(BitConverter.GetBytes(flags));

                if (bits.Get(1) || bits.Get(4))
                {
                    bits.Set(1, false);
                    bits.Set(4, false);

                    int[] modifiedBits = new int[1];

                    bits.CopyTo(modifiedBits, 0);

                    Marshal.WriteInt32(lParam + 8, modifiedBits[0]);
                }
            }

            if (OnKeyboardEvent == null)
            {
                return;
            }

            WindowsMessage msg = (WindowsMessage)((uint)wParam.ToInt32());

            VirtualKeyCode key = (VirtualKeyCode)Marshal.ReadInt32(lParam);

            switch (msg)
            {
            case WindowsMessage.WM_KEYDOWN:
                InvokeEventListeners(KeyState.Down, key);
                break;

            case WindowsMessage.WM_KEYUP:
                InvokeEventListeners(KeyState.Up, key);
                break;

            case WindowsMessage.WM_SYSKEYDOWN:
                InvokeEventListeners(KeyState.Down, key);
                break;

            case WindowsMessage.WM_SYSKEYUP:
                InvokeEventListeners(KeyState.Up, key);
                break;
            }
        }
Beispiel #12
0
        private static void WndProc(ref Message m)
        {
            WindowsMessage msg = (WindowsMessage)m.Msg;

            switch (msg)
            {
            case WindowsMessage.WM_DEVICECHANGE:

                break;
            }
        }
Beispiel #13
0
        public ClipboardTests(ITestOutputHelper testOutputHelper)
        {
            LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper);
            HwndSourceHook winProcHandler = (IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
            {
                // We can use the GetClipboardFormatName to get the string for the windows message... weird but it works
                Log.Verbose().WriteLine("WinProc {0}, {1}", hwnd, WindowsMessage.GetWindowsMessage((uint)msg));
                return(IntPtr.Zero);
            };

            WinProcHandler.Instance.Subscribe(winProcHandler);
        }
Beispiel #14
0
        private long Listener(
            HookCode nCode,
            WindowsMessage wParam,
            MsLlHookStruct lParam)
        {
            if (this.actions.TryGetValue(wParam, out var action))
            {
                this.sync.Post(state => action(), null);
            }

            return(User32.CallNextHookEx(
                       nCode: nCode,
                       wParam: wParam,
                       lParam: lParam));
        }
Beispiel #15
0
        /// <summary>
        /// Registers and application configuration interface with Snarl.
        /// (Is the same as snRegisterConfig2 from the official API)
        /// </summary>
        /// <param name="client">The client windows handle.</param>
        /// <param name="appName">Name to be displayed in Snarl's "Registered Applications" list. This should match the title of your application.</param>
        /// <param name="reply">Message to send to application configuration interface window is the application name is double clicked in Snarl.</param>
        /// <param name="iconPath">A path to an icon that will be displayed alongside the application name in Snarl.</param>
        /// <returns><see cref="M_RESULT"/> value indicating the result of the Snarl request.</returns>
        public static M_RESULT RegisterConfig(IntPtr client, string appName, WindowsMessage reply, string iconPath)
        {
            SNARLSTRUCT message = new SNARLSTRUCT();

            message.Cmd      = (Int16)SNARL_COMMAND.SNARL_REGISTER_CONFIG_WINDOW_2;
            message.LngData2 = client.ToInt32();
            message.Id       = (Int32)reply;
            message.Title    = StringToUtf8(appName);
            if (!string.IsNullOrEmpty(iconPath))
            {
                message.Icon = StringToUtf8(iconPath);
            }

            return(ConvertToMResult(Send(message, client)));
        }
Beispiel #16
0
        private IntPtr LowLevelKeyboardHook(int nCode, IntPtr wParam, IntPtr lParam)
        {
            WindowsMessage msg          = (WindowsMessage)wParam;
            bool           cntrlPressed = (Win32ApiWrapper.GetAsyncKeyState((int)VirtualKeyCode.VK_CONTROL) & 0x8000) != 0;

            if (nCode >= 0 && msg == WindowsMessage.WM_KEYUP)
            {
                KBDLLHook d = (KBDLLHook)Marshal.PtrToStructure(lParam, typeof(KBDLLHook));
                if (d.vkCode == (int)VirtualKeyCode.VK_INSERT && cntrlPressed)
                {
                    ThreadMsgQueue <Image> .Enqueue(generator.GetFocusedWindowImage());
                }
            }

            return(Win32ApiWrapper.CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam));
        }
Beispiel #17
0
        public void SendMouseUpMessageToMainWindow(MouseButtons button, int x, int y)
        {
            WindowsMessage msg    = WindowsMessage.WM_LBUTTONUP;
            MouseState     wParam = MouseState.MK_LBUTTON;

            if (button == MouseButtons.Left)
            {
                msg    = WindowsMessage.WM_LBUTTONUP;
                wParam = MouseState.MK_LBUTTON;
            }
            else if (button == MouseButtons.Right)
            {
                msg    = WindowsMessage.WM_RBUTTONUP;
                wParam = MouseState.MK_RBUTTON;
            }
            this.SendMouseMessageToMainWindow(msg, wParam, x, y);
        }
Beispiel #18
0
        public void SendMouseMoveMessageToMainWindow(MouseButtons button, int x, int y)
        {
            WindowsMessage msg    = WindowsMessage.WM_MOUSEMOVE;
            MouseState     wParam = MouseState.MK_LBUTTON;

            if (button == MouseButtons.Left)
            {
                wParam = MouseState.MK_LBUTTON;
            }
            else if (button == MouseButtons.Right)
            {
                wParam = MouseState.MK_RBUTTON;
            }
            else
            {
                wParam = MouseState.None;
            }
            this.SendMouseMessageToMainWindow(msg, wParam, x, y);
        }
Beispiel #19
0
        public static KeyboardEventArgs ProcessWindowsKeyMessage(ref WindowsMessage m)
        {
            var val             = m.LParam.ToInt64();
            KeyboardEventArgs e = new KeyboardEventArgs();

            e.KeyCode = Keys.None;
            if ((m.Msg == WM_KEYDOWN || m.Msg == WM_KEYUP) && ((int)m.WParam == VK_CONTROL || (int)m.WParam == VK_SHIFT))
            {
                switch ((OemScanCode)(((Int64)m.LParam >> 16) & 0x1FF))
                {
                case OemScanCode.LControl:
                {
                    e.KeyCode = Keys.LControlKey;
                }
                break;

                case OemScanCode.RControl:
                    e.KeyCode = Keys.RControlKey;
                    break;

                case OemScanCode.LShift:
                    e.KeyCode = Keys.LShiftKey;
                    break;

                case OemScanCode.RShift:
                    e.KeyCode = Keys.RShiftKey;
                    break;

                default:
                    if ((int)m.WParam == VK_SHIFT)
                    {
                        e.KeyCode = Keys.ShiftKey;
                    }
                    else if ((int)m.WParam == VK_CONTROL)
                    {
                        e.KeyCode = Keys.ControlKey;
                    }
                    break;
                }
            }
            return(e);
        }
Beispiel #20
0
 public static extern int PostMessage(IntPtr hWnd, WindowsMessage wMsg, int wParam, int lParam);
Beispiel #21
0
 internal static extern bool SendMessage(IntPtr hWnd, WindowsMessage Msg, Key wParam, IntPtr lParam);
Beispiel #22
0
 public static extern bool PostMessage(IntPtr hWnd, WindowsMessage Msg, int wParam, int lParam);
        protected IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (DataSource.SourceId.Id == 0)
            {
                handled = false;
                return IntPtr.Zero;
            }

            int pos = User32Native.GetMessagePos();

            WindowsMessage message = new WindowsMessage();
            message.hwnd = hwnd;
            message.message = msg;
            message.wParam = wParam;
            message.lParam = lParam;
            message.time = User32Native.GetMessageTime();
            message.x = (short)pos;
            message.y = (short)(pos >> 16);

            Marshal.StructureToPtr(message, _eventMessage.EventPtr, false);
            _eventMessage.Message = 0;

            TwainResult result = Twain32Native.DsEvent(
                ApplicationId,
                DataSource.SourceId,
                DataGroup.Control,
                DataArgumentType.Event,
                Message.ProcessEvent,
                ref _eventMessage);

            if (result == TwainResult.NotDSEvent)
            {
                handled = false;
                return IntPtr.Zero;
            }

            switch (_eventMessage.Message)
            {
                case Message.XFerReady:
                    Exception exception = null;
                    try
                    {
                        TransferPictures();
                    }
                    catch (Exception e)
                    {
                        exception = e;
                    }
                    CloseDsAndCompleteScanning(exception);
                    break;

                case Message.CloseDS:
                case Message.CloseDSOK:
                case Message.CloseDSReq:
                    CloseDsAndCompleteScanning(null);
                    break;

                case Message.DeviceEvent:
                    break;

                default:
                    break;
            }

            handled = true;
            return IntPtr.Zero;
        }
Beispiel #24
0
 public static extern IntPtr DefWindowProc(IntPtr hWnd, WindowsMessage msg, IntPtr wParam, IntPtr lParam);
Beispiel #25
0
 private static extern int SendMessage(IntPtr hWnd, WindowsMessage wMsg, IntPtr wParam, IntPtr lParam);
 IntPtr WindowProcedure(IntPtr handle, WindowsMessage message, IntPtr wParam, IntPtr lParam)
 {
     switch (message)
     {
         case WindowsMessage.Destroy:
             User32.UnregisterClass(_className, _instance);
             break;
         case WindowsMessage.Close:
             var e = new CancelEventArgs();
             if (!e.Cancel)
             {
                 DestroyWindow();
                 break;
             }
             return IntPtr.Zero;
         case WindowsMessage.WindowPositionChanged:
             var pos = (WindowPosition)Marshal.PtrToStructure(lParam, typeof(WindowPosition));
             if (!pos.Flags.HasFlag(SetWindowPosFlags.NoSize) && Resized != null) Resized(pos.Width, pos.Height);
             break;
         default:
             return User32.DefWindowProc(handle, message, wParam, lParam);
     }
     return IntPtr.Zero;
 }
Beispiel #27
0
 public delegate(bool, long) WndProcMessageDelegate(WindowsMessage msg, ulong wParam, long lParam);
Beispiel #28
0
		public static extern int UnregisterHotKey(IntPtr hWnd, WindowsMessage id);
Beispiel #29
0
		public static extern int RegisterHotKey(IntPtr hWnd, WindowsMessage id, ModKeyFlags modKey, System.Windows.Forms.Keys key);
Beispiel #30
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowsMessage Msg, int wParam, int lParam);
        public static bool Is(this int i, WindowsMessage msg)
        {
            int wm = (int)msg;

            return(i == wm);
        }
Beispiel #32
0
 internal static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WindowsMessage wParam, [In] MSLLHOOKSTRUCT lParam);
Beispiel #33
0
 public static extern int RegisterHotKey(IntPtr hWnd, WindowsMessage id, ModKeyFlags modKey, System.Windows.Forms.Keys key);
Beispiel #34
0
 public static extern int UnregisterHotKey(IntPtr hWnd, WindowsMessage id);
Beispiel #35
0
 public static extern int CallNextHookEx(IntPtr hHk, int nCode,
                                         WindowsMessage wParam, ref MouseHookStruct lParam);
Beispiel #36
0
		public bool IsHotKeyDown(WindowsMessage msg, IntPtr hotKeyLParam)
		{
			return (msg == WindowsMessage.WM_HOTKEY) && (hotKeyLParam == this.lParam);
		}
Beispiel #37
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowsMessage Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
        private void SnarlNotify(TweetCollection newTweets, string type)
        {
            string alertClass = "";
            if (type == "reply")
            {
                alertClass = "New reply";
            }
            else if (type == "directMessage")
            {
                alertClass = "New direct message";
            }
            else
            {
                alertClass = "New tweet";
            }

            if (newTweets.Count > Double.Parse(AppSettings.MaximumIndividualAlerts))
            {
                string defaultImage = "";
                string tempFile = System.IO.Path.GetTempFileName();
                WebClient client = new WebClient();
                try
                {
                    client.DownloadFile(twitter.CurrentlyLoggedInUser.ImageUrl, tempFile);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    tempFile = defaultImage;
                }


                WindowsMessage replyMsg = new WindowsMessage();

                SnarlConnector.ShowMessageEx("New tweets summarized", "You have new tweets!", BuiltNewTweetMessage(newTweets), int.Parse(Properties.Settings.Default.NotificationDisplayTime), tempFile, this.SnarlConfighWnd, replyMsg, "");
                if (tempFile != defaultImage)
                {
                    System.IO.File.Delete(tempFile);
                }
            }
            else
            {
                foreach (Tweet tweet in newTweets)
                {
                    string defaultImage = "";

                    string tempFile = System.IO.Path.GetTempFileName();
                    WebClient client = new WebClient();
                    try
                    {
                        client.DownloadFile(tweet.User.ImageUrl, tempFile);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        tempFile = defaultImage;
                    }

                    WindowsMessage replyMsg = new WindowsMessage();
                    SnarlConnector.ShowMessageEx(alertClass, tweet.User.ScreenName, string.Format("{0}\n\n{1}", tweet.Text, tweet.RelativeTime), int.Parse(Properties.Settings.Default.NotificationDisplayTime), tempFile, this.SnarlConfighWnd, replyMsg, "");
                    if (tempFile != defaultImage)
                    {
                        System.IO.File.Delete(tempFile);
                    }
                }
            }
        }
Beispiel #39
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowsMessage Msg, int wParam, int lParam);
Beispiel #40
0
 public static extern bool PostMessage(IntPtr hWnd, WindowsMessage Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
 public static bool Is(this uint i, WindowsMessage msg)
 {
     uint wm = (uint)msg;
     return (i == wm);
 }
        private void Hook_OnHookCalled(IntPtr wParam, IntPtr lParam)
        {
            if (lParam == IntPtr.Zero)
            {
                return;
            }

            IsMiddleMouseButtonPressed = false; // important to reset here

            WindowsMessage msg = (WindowsMessage)((uint)wParam.ToInt32());

            int x = Marshal.ReadInt32(lParam);
            int y = Marshal.ReadInt32(lParam + 4);

            int mouseData = Marshal.ReadInt32(lParam + 8);

            if (ClearInjectedFlag)
            {
                Marshal.WriteInt32(lParam + 12, 0);
            }

            switch (msg)
            {
            case WindowsMessage.WM_LBUTTONDBLCLK:
            case WindowsMessage.WM_NCLBUTTONDBLCLK:
                IsLeftMouseButtonPressed = true;

                InvokeEventListeners(KeyState.Down, VirtualKeyCode.LBUTTON, x, y);

                IsLeftMouseButtonPressed = false;

                InvokeEventListeners(KeyState.Up, VirtualKeyCode.LBUTTON, x, y);
                break;

            case WindowsMessage.WM_LBUTTONDOWN:
            case WindowsMessage.WM_NCLBUTTONDOWN:
                IsLeftMouseButtonPressed = true;
                InvokeEventListeners(KeyState.Down, VirtualKeyCode.LBUTTON, x, y);
                break;

            case WindowsMessage.WM_LBUTTONUP:
            case WindowsMessage.WM_NCLBUTTONUP:
                IsLeftMouseButtonPressed = false;
                InvokeEventListeners(KeyState.Up, VirtualKeyCode.LBUTTON, x, y);
                break;

            case WindowsMessage.WM_MBUTTONDOWN:
            case WindowsMessage.WM_NCMBUTTONDOWN:
                IsMiddleMouseButtonPressed = true;
                InvokeEventListeners(KeyState.Down, VirtualKeyCode.MBUTTON, x, y);
                break;

            case WindowsMessage.WM_MBUTTONUP:
            case WindowsMessage.WM_NCMBUTTONUP:
                IsMiddleMouseButtonPressed = false;
                InvokeEventListeners(KeyState.Up, VirtualKeyCode.MBUTTON, x, y);
                break;

            case WindowsMessage.WM_MBUTTONDBLCLK:
            case WindowsMessage.WM_NCMBUTTONDBLCLK:
                IsMiddleMouseButtonPressed = true;

                InvokeEventListeners(KeyState.Down, VirtualKeyCode.MBUTTON, x, y);

                IsMiddleMouseButtonPressed = false;

                InvokeEventListeners(KeyState.Up, VirtualKeyCode.MBUTTON, x, y);
                break;

            case WindowsMessage.WM_RBUTTONDBLCLK:
            case WindowsMessage.WM_NCRBUTTONDBLCLK:
                IsRightMouseButtonPressed = true;

                InvokeEventListeners(KeyState.Down, VirtualKeyCode.RBUTTON, x, y);

                IsRightMouseButtonPressed = false;

                InvokeEventListeners(KeyState.Up, VirtualKeyCode.RBUTTON, x, y);
                break;

            case WindowsMessage.WM_RBUTTONDOWN:
            case WindowsMessage.WM_NCRBUTTONDOWN:
                IsRightMouseButtonPressed = true;

                InvokeEventListeners(KeyState.Down, VirtualKeyCode.RBUTTON, x, y);
                break;

            case WindowsMessage.WM_RBUTTONUP:
            case WindowsMessage.WM_NCRBUTTONUP:
                IsRightMouseButtonPressed = false;

                InvokeEventListeners(KeyState.Up, VirtualKeyCode.RBUTTON, x, y);
                break;

            case WindowsMessage.WM_XBUTTONDBLCLK:
            case WindowsMessage.WM_NCXBUTTONDBLCLK:
                if (HIWORD(mouseData) == 0x1)
                {
                    IsXButton1Pressed = true;

                    InvokeEventListeners(KeyState.Down, VirtualKeyCode.XBUTTON1, x, y);

                    IsXButton1Pressed = false;

                    InvokeEventListeners(KeyState.Up, VirtualKeyCode.XBUTTON1, x, y);
                }
                else
                {
                    IsXButton2Pressed = true;

                    InvokeEventListeners(KeyState.Down, VirtualKeyCode.XBUTTON2, x, y);

                    IsXButton2Pressed = false;

                    InvokeEventListeners(KeyState.Up, VirtualKeyCode.XBUTTON2, x, y);
                }
                break;

            case WindowsMessage.WM_XBUTTONDOWN:
            case WindowsMessage.WM_NCXBUTTONDOWN:
                if (HIWORD(mouseData) == 0x1)
                {
                    IsXButton1Pressed = true;

                    InvokeEventListeners(KeyState.Down, VirtualKeyCode.XBUTTON1, x, y);
                }
                else
                {
                    IsXButton2Pressed = true;

                    InvokeEventListeners(KeyState.Down, VirtualKeyCode.XBUTTON2, x, y);
                }
                break;

            case WindowsMessage.WM_XBUTTONUP:
            case WindowsMessage.WM_NCXBUTTONUP:
                if (HIWORD(mouseData) == 0x1)
                {
                    IsXButton1Pressed = false;

                    InvokeEventListeners(KeyState.Up, VirtualKeyCode.XBUTTON1, x, y);
                }
                else
                {
                    IsXButton2Pressed = false;

                    InvokeEventListeners(KeyState.Up, VirtualKeyCode.XBUTTON2, x, y);
                }
                break;

            case WindowsMessage.WM_MOUSEWHEEL:
            case WindowsMessage.WM_MOUSEHWHEEL:
                InvokeEventListeners(KeyState.None, VirtualKeyCode.SCROLL, HIWORD(mouseData), HIWORD(mouseData));

                break;

            case WindowsMessage.WM_MOUSEMOVE:
            case WindowsMessage.WM_NCMOUSEMOVE:
                if (CaptureMouseMove)
                {
                    InvokeEventListeners(KeyState.None, VirtualKeyCode.INVALID, x, y);
                }
                break;
            }
        }
Beispiel #43
0
		public static int SendMessage (HandleRef windowHandle, WindowsMessage messageId, int generic16BitsParameter, int generic32BitsParameter)
		{
			int iResult = User32ApiNativeMethods.SendMessage (windowHandle, (int)messageId, generic16BitsParameter, generic32BitsParameter);
			return iResult;
		}