protected override bool ProcessKeyEventArgs(ref Message m) { if (m.Msg == 0x104) //WM_SYSKEYDOWN { return(base.ProcessKeyEventArgs(ref m)); } Keys keyData = Keys.None; if (m.Msg == 0x101) { //WM_KEYUP keyData = (Keys)m.WParam; } else if (m.Msg == 0x105) { //WM_SYSKEYUP ie. key up for alt held keyData = (Keys)m.WParam; } if (keyData != Keys.None) //we got a key! { //add modifier keys to keycode Keys mods = Control.ModifierKeys; if ((mods & Keys.Shift) != 0) { keyData |= (Keys)0x10000; } if ((mods & Keys.Control) != 0) { keyData |= (Keys)0x20000; } if ((mods & Keys.Alt) != 0) { keyData |= (Keys)0x40000; } KeyData kcode = WinFormsKeys.DecodeKey(keyData); if (kcode.KeyCode != KeyCode.Unknown) { bool block = ((Window)shellobject).OnRawKeyUp(new GuppyKeyArgs(shellobject, kcode)); if (block) { return(true); } } } return(base.ProcessKeyEventArgs(ref m)); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //we use this raw function catch tab key down etc KeyData kcode = WinFormsKeys.DecodeKey(keyData); if (kcode.KeyCode == KeyCode.Unknown) { return(base.ProcessCmdKey(ref msg, keyData)); //dont send unknown keys } char oldchar = kcode.Char; //remember to check if user changed key stroke bool block = ((Window)shellobject).OnRawKeyDown(new GuppyKeyArgs(shellobject, kcode)); if (block) { return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }