tags:

views:

699

answers:

2

A friend was having trouble figuring out how to assign "Ctrl + +" as a shortcut key to a ToolStripMenuItem. I pointed out that the Keys.OemPlus key would work and the display string for the shortcut needed to be set, but the Keys enumeration mystifies me.

What's the deal with these "OEM" keys? I've done a little searching and it seems like it's because the keys are only supported in Win2k or later, but that seems ridiculous as I'm certain people have been using the plus key decades before Win2k. Why's there no "OemEquals"? Are there other keys that are completely absent from the Keys enumeration?

I'm mostly looking for an answer to why these special-named values exist, but I'd love to hear discussion about the other questions. Is it safe to assume that since the plus sign is on top of the equals sign on my keyboard that using OemPlus and checking the Shift modifier key is an OK to tell if Ctrl + = was clicked? Are there other keys that were omitted?

Note this is not a WPF question, though the System.Windows.Forms.Keys and System.Windows.Input.Key enumerations look identical (though Key is named incorrectly according to the Framework Design Guidelines ;))

A: 

OEM means "Original Equipment Manufacturer" (or something relatively close to that). I think it's an attempt on WPF's part to be somewhat platform neutral. That's just an opinion though.

JaredPar
+3  A: 

They were introduced with the Windows API, they are not specific to WPF.

First, these are KEY codes, not character codes: they identify a key on your keyboard, not a character - e.g. the 'A' character is usually generated by pressing the A key while holding down a SHIFT key or having CAPS LOCK active.

The OEM keys are the keys that vary with local keyboards. Where the US keyboard has brackets and braces, german keyboards have umlauts.

They are called "OEM" because the Original Equipment Manufacturer (of the keyboard) was responsible for defining their functionality.

peterchen
I believe the various media keys are OEM keys as well.
Matt Olenik