I read somewhere that the Alt Gr key found on some layouts is a substitute for Ctrl + Alt.
However, what can this combination be used for? Are there any documented shortcuts using Ctrl + Alt?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
IBM named this key "alternate graphic" and it's not a substitute for CTRL + ALT, though CTRL + ALT was implemented as a substitute for ALT GR in Windows. It is a key modifier (like CTRL or SHIFT) that enables a different input than is normally expected of a key.
Depending on your keyboard and location setup, it can be used to produce characters with diacritical marks when used in conjunction with alphabetic keys (most often vowels), and the third symbol that is printed on some keys, for example, € (ALT GR + 4) or ¦ (ALT GR + `) that appear on my UK keyboard. Continental European keyboards generally have many more keys with extra symbols printed on them which correspond letters with the various types of diacritical marks used in those languages.
See AltGr key for more information.
For some keyboards, it allows some alternate combinations. In some keyboards it allows the cent symbol or the euro symbol - Wikipedia has a pretty comprehensive list of combinations using Alt Gr.
However using a US/Windows keymap, it doesn't do anything in most cases.
Alt gr is necessary for some languages like Polish:
Alt Gr + a = ą
Alt Gr + s = ś
Alt Gr + shift + n = Ń
Also, handy for people with accessibility needs who have to do a Ctrl+alt+del. You try it one-handed.
I am pretty sure it is implemented like this.
You can test the vkCode from the KBDLLHOOKSTRUCT to see what you get.
It should be equivalent to this:
isAltGr ? (Keys) (1 << 19) : Keys.None
private static Keys BuildKeyData(Keys virtualKeyCode) => virtualKeyCode | (IsDownControl ? Keys.Control : Keys.None) | (IsDownShift ? Keys.Shift : Keys.None) | (IsDownAlt ? Keys.Alt : Keys.None) | (IsAltGr ? (Keys) (1 << 19) : Keys.None); private static bool IsDownControl => IsKeyPressed((ushort)VirtualKeys.LeftControl) || IsKeyPressed((ushort)VirtualKeys.RightControl); private static bool IsDownShift => IsKeyPressed((ushort)VirtualKeys.LeftShift) || IsKeyPressed((ushort)VirtualKeys.RightShift); private static bool IsDownAlt => IsKeyPressed((ushort)VirtualKeys.LeftMenu) || IsKeyPressed((ushort)VirtualKeys.RightMenu) || IsKeyPressed((ushort)VirtualKeys.Menu); private static bool IsAltGr => IsDownControl && IsDownAlt;
Important Alt+Gr key combinations on a default German keyboard are: