by Michael S. Kaplan, published on 2005/11/17 04:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/11/17/492328.aspx
The other day, Jerry Pisk asked in the Suggestion Box:
How does Windows handle input from multiple keyboards? Can each keyboard have a different layout? Do dead and control (shift/control/alt/win/context) keys cross keyboards and what happens if each is set to a different layout? How about the lock keys (caps/num/scroll)?
To Windows, each thread has an input method (it might be a selected keyboard layout or whatever).
Whether there is one keyboard or many keyboards, than each of those keyboards has a bunch of keys on it and each key has a scan code. It is the keyboard layout that takes those scan codes and maps them to virtual keys and sometimes even characters. But it does not pay attention to which hardware keyboard you type on (you can even split typing between them, mixing the typing of dead keys between them).
So the answer to your question would be that each thread can have a different layout but the keyboards themselves are all shared for the system when they are typed in.
Now application developers can take advantage of Raw Input between the various Human Interface Devices such as keyboards, joysticks, mice, microphones, and so on. You could even theoretically use this information to distinguish between keyboards and then use the traditional Keyboard Input API functions to map each keyboard to a different layout. But that would be a lot of work to do, especially in cases where you would have to keep your own buffer for the input of dead keys and such.
It is much more reasonable to stick with the built-in model, in my opinion. :-)
This post brought to you by "ʢ" (U+02a2, LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE)
# Rosyna on 17 Nov 2005 7:34 AM:
# Jerry Pisk on 17 Nov 2005 2:19 PM:
# Gabe on 18 Nov 2005 4:48 AM:
# Michael S. Kaplan on 18 Nov 2005 6:10 AM:
# Jerry Pisk on 18 Nov 2005 3:09 PM:
# Michael S. Kaplan on 18 Nov 2005 10:02 PM:
go to newer or older post, or back to index or month or day