While searching for some shortcuts for my application, I stumbled over some constants in the C# Keys enumeration:
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?)
Keys like Select, Attn, Pa1, etc. that can be found from Microsoft documentation for virtual key codes, are remnants from the early PC era when terminal emulation was still a dominant field of application. For example the LK201 keyboard used in DEC VT220 terminal and Rainbow 100 computer has a Select key.
Most prominently however these keys appear on a 122-key IBM Model F keyboard for 3270/3179/3180/5250 terminals:
(image source: ClickyKeyboards.com)
IBM included support for multiple keyboard types in the original Model 5150 PC specification. Even though the first PC keyboard was the 83-key Model F, other keyboards can be used with an adapter board. In fact, IBM marketed a 3270 PC which was a set of expansion boards in a PC XT, making it a fully fledged 3270 terminal.
Further reading:
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With