Alexander Stalt Alexander Stalt - 1 month ago 19
C# Question

Handle that Shift+F10 w(h)as pressed?

I want to use the exclusive key to open context menu that are available in most of the new laptops and keyboards. This key is usually available between right ALT and CTRL key.

I am not sure that it is always equivalent to "Shift + F10" ( or is it always equivalent to "Shift+F10" ?).

My programs runs on Windows XP and earlier versions.

Context menu should appear at mouse cursor position (if it's possible).

Answer

It generates the Keys.Apps keystroke. Paste this code into your form:

protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
  if (keyData == Keys.Apps) {
    MessageBox.Show("Context menu here please");
    return true;
  }
  return base.ProcessCmdKey(ref msg, keyData);
}
Comments