public bool PreFilterMessage(ref Message m) { if ((m.Msg == WM.KEYDOWN || m.Msg == WM.SYSKEYDOWN) && discoveryform.CanFocus) { var activeform = System.Windows.Forms.Form.ActiveForm; //System.Diagnostics.Debug.WriteLine("Active form " + activeform?.GetType().Name); if (ignoredforms == null || activeform == null || Array.IndexOf(ignoredforms, activeform.GetType()) == -1) { Keys k = (Keys)m.WParam; if (k != Keys.ControlKey && k != Keys.ShiftKey && k != Keys.Menu) { string name = k.VKeyToString(Control.ModifierKeys); //System.Diagnostics.Debug.WriteLine("Keydown " + m.LParam + " " + name + " " + m.WParam + " " + Control.ModifierKeys); if (actcontroller.CheckKeys(name)) { return(true); // swallow, we did it } } } } return(false); }
public bool PreFilterMessage(ref Message m) { if ((m.Msg == WM.KEYDOWN || m.Msg == WM.SYSKEYDOWN) && discoveryform.CanFocus) { Keys k = (Keys)m.WParam; if (k != Keys.ControlKey && k != Keys.ShiftKey && k != Keys.Menu) { //System.Diagnostics.Debug.WriteLine("Keydown " + m.LParam + " " + k.ToString(Control.ModifierKeys) + " " + m.WParam + " " + Control.ModifierKeys); if (actcontroller.CheckKeys(k.ToString(Control.ModifierKeys))) { return(true); // swallow, we did it } } } return(false); }
public bool PreFilterMessage(ref Message m) { if (discoveryform.CanFocus) { if (m.Msg == WM.KEYDOWN || m.Msg == WM.SYSKEYDOWN) { var activeform = System.Windows.Forms.Form.ActiveForm; if (ignoredforms == null || activeform == null || Array.IndexOf(ignoredforms, activeform.GetType()) == -1) { Keys k = (Keys)m.WParam; string name = k.WMKeyToString((ulong)m.LParam, Control.ModifierKeys); //System.Diagnostics.Debug.WriteLine($"Keydown {(ulong)m.LParam:X} {(ulong)m.WParam:X4} {Control.ModifierKeys} = {name}"); if (actcontroller.CheckKeys(name)) { return(true); // swallow, we did it } } } else if (m.Msg == WM.KEYUP) { var activeform = System.Windows.Forms.Form.ActiveForm; //System.Diagnostics.Debug.WriteLine("Active form " + activeform?.GetType().Name); if (ignoredforms == null || activeform == null || Array.IndexOf(ignoredforms, activeform.GetType()) == -1) { Keys k = (Keys)m.WParam; string name = k.WMKeyToString((ulong)m.LParam, Control.ModifierKeys); // System.Diagnostics.Debug.WriteLine($"Keyup {(ulong)m.LParam:X} {(ulong)m.WParam:X4} {Control.ModifierKeys} = {name}"); if (actcontroller.CheckReleaseKeys(name)) { return(true); // swallow, we did it } } } } return(false); }