What is the SELECT key?

c#, keyboard, keydown

Solution

`VK_SELECT` is the key code for a Select key that doesn't exist on most keyboards. I'm pretty sure that I haven't seen one.

You can check to see if your keyboard supports it by calling the MapVirtualKey function, which can map the virtual key code to a keyboard scan code. If the function returns 0, then there is no mapping.

I created a little Windows Forms app that illustrates this. Just make a form and hook up a KeyDown handler:

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace testoForm
{
    public partial class Form1 : Form
    {
        [DllImport("user32")]
        static extern UInt32 MapVirtualKey(UInt32 nCode, UInt32 uMapType);
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            ShowKey(e.KeyCode);
        }

        private void ShowKey(Keys key)
        {
            var keyCode = (UInt32)key;
            var scanCode = MapVirtualKey(keyCode, 0);
            var s = String.Format("VK = {0:X2}, SC={1:X2}", keyCode, scanCode);
            MessageBox.Show(s);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ShowKey(Keys.Select);
        }
    }
}

If you press a key, a message box will show the key code and the mapped scan code. I added a button that will show the scan code for the Select key. On my system, the function returns 0 for `Keys.Select`.

Problem

While searching for some shortcuts for my application, I stumbled over some constants in the C# Keys enumeration: - Select - Separator - ProcessKey - Pa1 - Crsel - Execute There's no further information for them on MSDN. The questions is: which keyboard key corresponds to those values? (And are they on a standard keyboard layout?)

Original source