Hi,
How can I detect on my Form if the following key combination is pressed in sequence.
Hold ALT then 'P' then 'A' then 'U' then 'L'
Thanks
Paul.
Hi Paul,
Here's an example how to do it.
private StringBuilder _pressedKeys = new StringBuilder(); protected override void OnKeyDown(KeyEventArgs e) { if (ModifierKeys == Keys.Alt) { var letter = (char)e.KeyValue; if (!char.IsLetterOrDigit(letter)) { return; } _pressedKeys.Append(letter); if (_pressedKeys.ToString().ToLower() == "myword") { MessageBox.Show("It works!"); _pressedKeys.Clear(); } } else { _pressedKeys.Clear(); } base.OnKeyDown(e); }
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?