I want to show users a list of the deadkeys they can press using their current Windows language & keyboard. (As opposed to a list of possible graves, circumflexes and acutes which their keyboard doesn't operate as deadkeys.) Grateful for help.
Asked
Active
Viewed 353 times
-2
-
1I don't know what a deadkey is, let alone how you want to display it. – Mikkel Jan 12 '20 at 12:06
-
@Mikkel, dead keys are described for example [here](https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-deadchar). – TLama Jan 12 '20 at 14:34
-
Does this require retrieving the [physical layout](https://stackoverflow.com/questions/4719488/get-physical-keyboard-layout-programmatically)? – Sertac Akyuz Jan 12 '20 at 14:52
-
@SertacAkyuz, no. I only want to know for example that a user's keyboard driver can only manage ~ and ' as deadkeys, so I can show them which uses of those deadkeys they can get in my program. – Mike Scott Jan 12 '20 at 15:58
-
So how are you going to show the user these deadkeys? Should you show them like zombies, dancing? – Mikkel Jan 13 '20 at 03:14
-
I believe you may run into one or two issues. Firstly the possibility to get any character using Alt-codes (i.e. Alt+132 for ä). And secondly the fact that keyboards will give you more than you can see using more or less elaborate key combinations (i.e. Ctrl+Alt+q for ä). – Sherlock70 Jan 13 '20 at 07:33
-
@Mikkel just a line in a listbox – Mike Scott Jan 13 '20 at 11:23
-
@Sherlock70 it's not the total number of possibilities I'm interested in. On an ordinary UK keyboard, there is only one key which can act as a deadkey: the top left one. On an Extended keyboard there are several. On a US international there are lots more. I need to know which keyboard driver is currently loaded (and I can do that OK) but then my question is **which are the deadkeys** on that keyboard driver. – Mike Scott Jan 13 '20 at 11:27
1 Answers
2
Keyboard layout (including dead keys) are fixed in the keyboard driver. This means your problem can be reduce to getting the setting for keyboard. Use Windows API GetLocaleInfoW() function to get the information and then create the list of dead keys for each keyboard. For your reference have a look at: Windows-keyboard-layout and GetLocaleInfoW

fpiette
- 11,983
- 1
- 24
- 46
-
Thanks, Francois. Those layouts are informative. Even so, I would have liked to find a way to query the keyboard driver to find its deadkeys. Using MapVirtualKeyExW and ToUnicode I'm not succeeding... – Mike Scott Jan 14 '20 at 18:27
-
@Mike maybe you misunderstood me... You can create the list yourself since it is fixed for all keyboards using Microsoft driver. Please not that sometimes the same symbol appears twice on a layout. For example, on a French (Belgian) keyboard, the "^" (Circonflex) is on the key with number 6 as well on the key on the right of the letter P key. The first one is the third symbol, accessible while using ALT-GR and the later is the dead key for creating ê (e-circonflx) character. If you find my answer a correct answer for your question, please mark it as such. – fpiette Jan 16 '20 at 10:02