tags:

views:

91

answers:

1

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).

+3  A: 

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);
}
Hans Passant
Wonderful ! It works good.PS: strange name "Keys.Apps" for context menu though ...
Alexander Stalt