Multiple keyboards...same application

Spektre

Newcomer
Joined
Jul 26, 2003
Messages
19
Hello,

How woudl you go about accessing two keybaords in the same application? Say a head to head game. Two monitors is trivial to support thru the OS. How would you access two keyboards though? Direct HID calls? Can anyone point me to an example?

Spektre
 
To the best of my knowledge, if you had two keyboards attached to the same PC then either, only one would work or more likely both would work the same. Basically they would both send the same messages so would be indistiguishable. If you wished to have two players from the same PC they would have to have different keys. But if the players are anything like me they would use the other keys to throw of your opponent, lol.
 
I have two keyboards and three mice hooked up to my computer (wired/wireless sets). I have never seen an application treat them as separate devices, however the advantage is that although a keyboard can only send so many keys to the computer at a time, with two keyboards you can send twice as many keystrokes (good for emulators, which are, of course, only used in a manner consistent with the law).

If there is any way to distinguish the source of the keystrokes, however, you would have to get pretty low level. I do not believe that DirectX can provide this kind of data to you, and I'm nearly positive that Windows API won't. I would say that maybe setting up a hook would be your best bet (although I believe that some anti-virus or anti-spyware software will report system-wide keyboard hooks as key loggers). Not incredibly helpful, but maybe a starting point.
 
Thanks for the insights.

Seperate keys will not work, as the players need access to the full alphabet. No idea how to do low level keyboard hooks.

Two networked PCs would work, but what a waste...

Thanks again.
 
Back
Top