private void _RecieveMessage(WindowMessages Message) { if (Message == WindowMessages.CloseWindow) { _viewModel.RefreshBooks(); } }
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); }
protected override void WndProc(ref Message m) { WindowMessages wm = (WindowMessages)m.Msg; if (wm == WindowMessages.BeginSession) { BeginSession(); } base.WndProc(ref m); }
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); }
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; }
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(); } } }
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); }
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); }
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))); }
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); }
private void SetDialogResultMessage(WindowMessages.SetDialogResultMessage m) { this.DialogResult = m.DialogResult; }
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; } }
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);
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)); }
public void PostMessage(WindowMessages msg) { NativeMethods.PostMessage(Handle, (int)msg, IntPtr.Zero, IntPtr.Zero); }
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))); }
public virtual void NewMessage(int ctrlIndex, WindowMessages message) { // override in main windows, called by controls }
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))); }
private static void OnArrangeWindowsMessage(WindowMessages.ArrangeWindowsMessage m) { WindowUtility.ArrangeMainWindows(m.Mode); }
private static extern int NativeSendMessage(IntPtr hWnd, WindowMessages msg, IntPtr wParam, UIntPtr lParam);
public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hwnd, WindowMessages msg, IntPtr wParam, IntPtr lParam);
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); }
internal static extern bool PostMessage(IntPtr hWnd, WindowMessages Msg, IntPtr wParam, IntPtr lParam);
public void PostMessage(WindowMessages msg, IntPtr wParam, IntPtr lParam) { NativeMethods.PostMessage(Handle, (int)msg, wParam, lParam); }
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(); }
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); }
private void SetIsActiveMessage(WindowMessages.SetIsActiveMessage m) { this.Activate(); }
private void WindowMessages_SetIsActiveMessage(WindowMessages.SetIsActiveMessage m) { if(m.IsActive) { this.Window.Activate(); } else { } }
private void RequestDialogResultMessage(WindowMessages.RequestDialogResultMessage m) { m.DialogResult = this.DialogResult; }
private void RequestRestoreBoundsMessage(WindowMessages.RequestRestoreBoundsMessage m) { m.Bounds = this.RestoreBounds; }
private void PostKeyMessage(Keys key, WindowMessages message, uint lParam) { _emitter.PostMessage(_windowHandle, message, new IntPtr((int)key), new UIntPtr(lParam)); }
private void ShouldReceiveKeyMessage(WindowMessages message, Keys key) { _emitterMock.Verify(x => x.PostMessage(WindowHandle, message, new IntPtr((int)key), It.IsAny <UIntPtr>())); }
public static extern IntPtr SendMessageTimeout(IntPtr windowHandle, WindowMessages Msg, IntPtr wParam, IntPtr lParam, SendMessageTimeOutFlags flags, int timeout, ref IntPtr result);
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);
public static extern int DwmDefWindowProc(IntPtr hwnd, WindowMessages message, IntPtr wParam, IntPtr lParam, ref IntPtr result);
internal static extern bool PostMessage(IntPtr hWnd, WindowMessages message, IntPtr wParam, UIntPtr lParam);
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)); }
public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WindowMessages wParam, ref KeyboardHookInput lParam);
public IntPtr SendMessage(WindowMessages msg, IntPtr wParam, IntPtr lParam) { return(NativeMethods.SendMessage(Handle, msg, wParam, lParam)); }
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)); }
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);