Beispiel #1
0
 private void _RecieveMessage(WindowMessages Message)
 {
     if (Message == WindowMessages.CloseWindow)
     {
         _viewModel.RefreshBooks();
     }
 }
Beispiel #2
0
        private IntPtr HookCallback(int code, WindowMessages wParam, KeyboardHookInput lParam)
        {
            IntPtr result;

            try
            {
                if (code >= 0)
                {
                    var key = (VirtualKey)Marshal.ReadInt32(new IntPtr(lParam.VirtualKey));

                    if (wParam == WindowMessages.KeyDown || wParam == WindowMessages.SysKeyDown)
                    {
                        KeyDown?.Invoke(this, key);
                    }

                    if (wParam == WindowMessages.KeyUp || wParam == WindowMessages.SysKeyUp)
                    {
                        KeyUp?.Invoke(this, key);
                    }
                }
            }
            finally
            {
                result = User32.CallNextHookEx(_hook, code, wParam, ref lParam);
            }

            return(result);
        }
Beispiel #3
0
        protected override void WndProc(ref Message m)
        {
            WindowMessages wm = (WindowMessages)m.Msg;

            if (wm == WindowMessages.BeginSession)
            {
                BeginSession();
            }
            base.WndProc(ref m);
        }
Beispiel #4
0
        protected override void WndProc(ref Message m)
        {
            WindowMessages wm = (WindowMessages)m.Msg;

            switch (wm)
            {
            case WindowMessages.WM_HOTKEY:
                ProcessHotKey(m.WParam.ToInt32());
                break;
            }
            base.WndProc(ref m);
        }
Beispiel #5
0
        public Form1()
        {
            InitializeComponent();
            FM = new FormMgr(this);

            WindowMessages = Sender.AllWMMessages();
            SendMessageMessage.Items.AddRange(WindowMessages.ToArray());
            SendMessageResult.Text = "";

            Longs = Sender.AllGWLs();
            SetWindowLongIndex.Items.AddRange(Longs.ToArray());
            SetWindowLongLong_SingleSelect.Visible = true;
            SetWindowLongLong_MultiSelect.Visible  = false;
        }
Beispiel #6
0
        protected override void WndProc(ref Message m)
        {
            WindowMessages msg = (WindowMessages)m.Msg;

            if (msg == WindowMessages.WM_SHOWWINDOW)
            {
                if (m.WParam != IntPtr.Zero)
                {
                    ShowEditControl();
                }
                else
                {
                    HideEditControl();
                }
            }
        }
Beispiel #7
0
        private bool HookProcInner(int nCode, WindowMessages wParam, ref LowLevelKeyStruct lParam)
        {
            if (nCode < 0)
            {
                return(false);
            }
            if (lParam.Flags.HasFlag(LowLevelKeyFlags.Injected))
            {
                return(false);
            }

            bool             alt = lParam.Flags.HasFlag(LowLevelKeyFlags.AltDown);
            Keys             key = alt ? lParam.VkCode | Keys.Alt : lParam.VkCode;
            KeyHookEventArgs e   = new KeyHookEventArgs(key);

            KeyEvent?.Invoke(e);
            return(e.Handled);
        }
Beispiel #8
0
        protected override void WndProc(ref Message m)
        {
            WindowMessages wm = (WindowMessages)m.Msg;

            switch (wm)
            {
            case WindowMessages.WM_DRAWCLIPBOARD:
                if (hwndNextViewer != null)
                {
                    User32.SendMessage(hwndNextViewer, (int)WindowMessages.WM_CHANGECBCHAIN, m.WParam, m.LParam);
                }
                if (!m_bCallingSetClipboardViewer)
                {
                    GrabClipboard();
                }
                break;

            case WindowMessages.WM_CHANGECBCHAIN:
                // If the next window is closing, repair the chain.

                if ((IntPtr)m.WParam == hwndNextViewer)
                {
                    hwndNextViewer = (IntPtr)m.LParam;
                }

                // Otherwise, pass the message to the next link.

                else if (hwndNextViewer != null)
                {
                    User32.SendMessage(hwndNextViewer, (int)WindowMessages.WM_CHANGECBCHAIN, m.WParam, m.LParam);
                }

                break;

            case WindowMessages.WM_CLIPBOARDUPDATE:
                if (!m_bCallingSetClipboardViewer)
                {
                    GrabClipboard();
                }
                break;
            }
            base.WndProc(ref m);
        }
Beispiel #9
0
        private void ShouldReceiveKeyMessage(WindowMessages message, Keys key, bool alt, bool repeat, bool up,
                                             ushort repeatCount)
        {
            uint expectedLParam = repeatCount;

            if (alt)
            {
                expectedLParam |= 0x20000000;
            }
            if (repeat)
            {
                expectedLParam |= 0x40000000;
            }
            if (up)
            {
                expectedLParam |= 0x80000000;
            }

            _emitterMock.Verify(x =>
                                x.PostMessage(WindowHandle, message, new IntPtr((int)key), ValueWithoutScanCode(expectedLParam)));
        }
Beispiel #10
0
        private IntPtr WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, ref Boolean handled)
        {
            switch (msg)
            {
            case WindowMessages.WM_DRAWCLIPBOARD:
                this.ClipboardContentChanged?.Invoke(this, new EventArgs());

                handled = true;

                break;

            case WindowMessages.WM_CHANGECBCHAIN:
                WindowMessages.SendMessage(this.NextClipboardViewerHandle, (UInt32)msg, wParam, lParam);

                handled = true;

                break;
            }

            return(IntPtr.Zero);
        }
Beispiel #11
0
 private void SetDialogResultMessage(WindowMessages.SetDialogResultMessage m)
 {
     this.DialogResult = m.DialogResult;
 }
Beispiel #12
0
        private void SetRestoreBoundsMessage(WindowMessages.SetRestoreBoundsMessage m)
        {
            /*var hwnd = new WindowInteropHelper(this).Handle;
            var placement = new WindowPlacement();

            User32.GetWindowPlacement(hwnd, ref placement);

            placement.NormalPosition = new Rectangle() {
                Left = (int)m.Bounds.Left,
                Right = (int)m.Bounds.Right,
                Top = (int)m.Bounds.Top,
                Bottom = (int)m.Bounds.Bottom,
            };
            User32.SetWindowPlacement(hwnd, ref placement);*/
            var prevWS = this.WindowState;
            if(prevWS == WindowState.Maximized) {
                this.WindowState = WindowState.Normal;
            }
            this.Left = m.Bounds.Left;
            this.Top = m.Bounds.Top;
            this.Width = m.Bounds.Width;
            this.Height = m.Bounds.Height;
            if(prevWS != this.WindowState) {
                this.WindowState = prevWS;
            }
        }
Beispiel #13
0
 private void RequestIsActiveMessage(WindowMessages.RequestIsActiveMessage m)
 {
     m.IsActive = this.IsActive;
 }
 private void ShouldReceiveKeyMessage(WindowMessages message, Keys key)
 {
     _emitterMock.Verify(x =>
         x.PostMessage(WindowHandle, message, new IntPtr((int) key), It.IsAny<UIntPtr>()));
 }
 internal static extern bool SendNotifyMessage(IntPtr hWnd, WindowMessages msg, UIntPtr wParam, IntPtr lParam);
Beispiel #16
0
 private IntPtr SendMessageTimeOut(WindowMessages msg, IntPtr wParam, IntPtr lParam, NativeMethods.SendMessageTimeOutFlags flags, int timeout, ref IntPtr result)
 {
     return(NativeMethods.SendMessageTimeout(Handle, (int)msg, wParam, lParam, flags, timeout, ref result));
 }
Beispiel #17
0
 public void PostMessage(WindowMessages msg)
 {
     NativeMethods.PostMessage(Handle, (int)msg, IntPtr.Zero, IntPtr.Zero);
 }
Beispiel #18
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowMessages Msg, int wParam, int lParam);
        private void ShouldReceiveKeyMessage(WindowMessages message, Keys key, bool alt, bool repeat, bool up,
            ushort repeatCount)
        {
            uint expectedLParam = repeatCount;
            if (alt) expectedLParam |= 0x20000000;
            if (repeat) expectedLParam |= 0x40000000;
            if (up) expectedLParam |= 0x80000000;

            _emitterMock.Verify(x =>
                x.PostMessage(WindowHandle, message, new IntPtr((int) key), ValueWithoutScanCode(expectedLParam)));
        }
Beispiel #20
0
 public virtual void NewMessage(int ctrlIndex, WindowMessages message)
 {
     // override in main windows, called by controls
 }
Beispiel #21
0
 public static extern IntPtr DefWindowProc(IntPtr hWnd, WindowMessages Msg, UIntPtr wParam, IntPtr lParam);
 private void ShouldReceiveKeyMessage(WindowMessages message, Keys key, byte scancode)
 {
     _emitterMock.Verify(x =>
         x.PostMessage(WindowHandle, message, new IntPtr((int) key), ItHasScanCode(scancode)));
 }
Beispiel #23
0
 private static void OnArrangeWindowsMessage(WindowMessages.ArrangeWindowsMessage m)
 {
     WindowUtility.ArrangeMainWindows(m.Mode);
 }
 private static extern int NativeSendMessage(IntPtr hWnd, WindowMessages msg, IntPtr wParam, UIntPtr lParam);
Beispiel #25
0
 public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hwnd, WindowMessages msg, IntPtr wParam, IntPtr lParam);
Beispiel #26
0
 internal static extern int SendMessage(IntPtr hWnd, WindowMessages msg, int Param, StringBuilder text);
 public void SendMessage(IntPtr windowHandle, WindowMessages message, IntPtr wParam, UIntPtr lParam)
 {
     NativeSendMessage(windowHandle, message, wParam, lParam);
 }
Beispiel #28
0
 internal static extern bool PostMessage(IntPtr hWnd, WindowMessages Msg, IntPtr wParam, IntPtr lParam);
Beispiel #29
0
 public void PostMessage(WindowMessages msg, IntPtr wParam, IntPtr lParam)
 {
     NativeMethods.PostMessage(Handle, (int)msg, wParam, lParam);
 }
Beispiel #30
0
 internal static extern IntPtr SendMessage(IntPtr hWnd, WindowMessages Msg, IntPtr wParam, IntPtr lParam);
			private void WindowMessages_SetRestoreBoundsMessage(WindowMessages.SetRestoreBoundsMessage m) {
				var state = this.Window.WindowState;
				this.Window.WindowState = WindowState.Normal;
				this.Window.Top = m.Bounds.Top;
				this.Window.Left = m.Bounds.Left;
				this.Window.Width = m.Bounds.Width;
				this.Window.Height = m.Bounds.Height;
				this.Window.WindowState = state;
			}
			private void WindowMessages_CloseMessage(WindowMessages.CloseMessage m) {
				this.Window.Close();
			}
Beispiel #33
0
 private static extern bool PostThreadMessage(uint threadId, WindowMessages msg, IntPtr wParam, UIntPtr lParam);
			private void WindowMessages_MessageBoxMessage(WindowMessages.MessageBoxMessage m) {
				m.Result = MessageBox.Show(this.Window, m.Message, m.Title, m.Button, m.Image, m.Default, m.Options);
			}
Beispiel #35
0
 private void SetIsActiveMessage(WindowMessages.SetIsActiveMessage m)
 {
     this.Activate();
 }
			private void WindowMessages_SetIsActiveMessage(WindowMessages.SetIsActiveMessage m) {
				if(m.IsActive) {
					this.Window.Activate();
				} else {
				}
			}
Beispiel #37
0
 private void RequestDialogResultMessage(WindowMessages.RequestDialogResultMessage m)
 {
     m.DialogResult = this.DialogResult;
 }
Beispiel #38
0
 private static extern bool PostThreadMessage(uint threadId, WindowMessages msg, IntPtr wParam, UIntPtr lParam);
Beispiel #39
0
 private void RequestRestoreBoundsMessage(WindowMessages.RequestRestoreBoundsMessage m)
 {
     m.Bounds = this.RestoreBounds;
 }
Beispiel #40
0
 private void PostKeyMessage(Keys key, WindowMessages message, uint lParam)
 {
     _emitter.PostMessage(_windowHandle, message,
                          new IntPtr((int)key), new UIntPtr(lParam));
 }
Beispiel #41
0
 private void ShouldReceiveKeyMessage(WindowMessages message, Keys key)
 {
     _emitterMock.Verify(x =>
                         x.PostMessage(WindowHandle, message, new IntPtr((int)key), It.IsAny <UIntPtr>()));
 }
Beispiel #42
0
 public static extern IntPtr SendMessageTimeout(IntPtr windowHandle, WindowMessages Msg, IntPtr wParam,
                                                IntPtr lParam, SendMessageTimeOutFlags flags, int timeout, ref IntPtr result);
Beispiel #43
0
 private void ShouldReceiveKeyMessage(WindowMessages message, Keys key, byte scancode)
 {
     _emitterMock.Verify(x =>
                         x.PostMessage(WindowHandle, message, new IntPtr((int)key), ItHasScanCode(scancode)));
 }
 private static extern bool NativePostMessage(IntPtr hWnd, WindowMessages msg, IntPtr wParam, UIntPtr lParam);
Beispiel #45
0
 public static extern int DwmDefWindowProc(IntPtr hwnd, WindowMessages message, IntPtr wParam, IntPtr lParam, ref IntPtr result);
Beispiel #46
0
 internal static extern bool PostMessage(IntPtr hWnd, WindowMessages message, IntPtr wParam, UIntPtr lParam);
Beispiel #47
0
 public static extern IntPtr PostMessage(IntPtr hWnd, WindowMessages msg, IntPtr wParam, IntPtr lParam);
 public void PostMessage(IntPtr windowHandle, WindowMessages message, IntPtr wParam, UIntPtr lParam)
 {
     PInvokeHelper.ThrowWin32ErrorIfFalse(() =>
         NativePostMessage(windowHandle, message, wParam, lParam));
 }
Beispiel #49
0
 public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WindowMessages wParam, ref KeyboardHookInput lParam);
Beispiel #50
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowMessages Msg, int wParam, int lParam);
Beispiel #51
0
 public IntPtr SendMessage(WindowMessages msg, IntPtr wParam, IntPtr lParam)
 {
     return(NativeMethods.SendMessage(Handle, msg, wParam, lParam));
 }
Beispiel #52
0
        public IntPtr SendMessageTimeOut(WindowMessages msg, IntPtr wParam, IntPtr lParam)
        {
            IntPtr zero = IntPtr.Zero;

            return(NativeMethods.SendMessageTimeout(Handle, msg, wParam, lParam, NativeMethods.SendMessageTimeOutFlags.AbortIfHang, 0, ref zero));
        }
Beispiel #53
0
 public static extern IntPtr SendMessage(IntPtr hWnd, WindowMessages Msg, Int32 wParam, IntPtr lParam);
 static extern bool PostMessage(IntPtr hWnd, WindowMessages Msg, IntPtr wParam, IntPtr lParam);