How to differentiate multiple USB keyboard & mices connected to a unique PC.

Hello,
   I'm looking for a way to get events from multiple USB keyboards & mices connected to a same PC through an USB hub. At first approach, the events seems to be the same (using C-SDK, WM_events, etc...). It is a "first step", they all can be connected and work !
...but my question is on how to know in *which* keyboard a key has been pressed (a kind of device id or something like that), same problem about USB mouce (click, move...)...
I'm working in C/C++ (SDK/MFC) under Windows XP (Visual Studio 6, not .NET).
I've no idea on how to to this, but if i'm asking how to make Keyboard/mice USB drivers, please, let me know and try to explain me ho to do that, that's why i'm given a lot of points on this question... But if there is a simple solution, i'll take it !

Thank you in advance,
Alexander
LVL 1
AlexanderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
You can't do it without creating your own USB mouse and keyboard drivers. This is a hard job. Standard mouse and keyboard drivers send key information to Windows, without specifying origin.
0
AlexanderAuthor Commented:
uh !? :( Then can you tell me how to make a driver or someplace (link, book, etc...) where i can go learn how to do it ?
0
Jaime OlivaresSoftware ArchitectCommented:
Could you give me more details about your needs? You cannot generate standard windows event messages specifying input origin, usual trick is to send events from one specific keyboard to a specific app/window
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

AlexanderAuthor Commented:
ok, in fact i need to connect 3 USB keyboards and 3 USB mouses into one PC and make a software able to get events (not necessary WM_events...) from those 6 devices with an "id" per device, i've talk about C-SDK windows & MFC to tell what i've "already tested", but if there is a "hard whay" like using raw data flows or pipes or anything else i'm open to it !
0
Jaime OlivaresSoftware ArchitectCommented:
And what practical application do you want to do with it?
To run 3 softwares with 3 different mouse/keyboard? or you want to use all these with the same software instance?
0
AlexanderAuthor Commented:
i want to use them with the same software instance...
0
Jaime OlivaresSoftware ArchitectCommented:
I have faced that requirement for industrial software with big control panels but I have solved it by building special button panels and sending orders through serial port.
0
AlexanderAuthor Commented:
Nope, i can't use serial port and i really need three (or more) couples of mouse/keyboard. It is for a kind of "input media server", if you see what i mean.
0
Jaime OlivaresSoftware ArchitectCommented:
There are not much applications like you want. I guess you want  3 persons to share the same computer for data entry.

There was a Win98 product called easyclone, but works only for 2 machines.
http://www.dansdata.com/easyclone.htm

The reason is that cost benefit is marginal, still you need another mouse, keyboard and monitor and config could be  a little complicated.
A better aproach is to buy some used PCs and create a Web application, so you can have just one computer collecting data from unlimited computers. Those computer you can buy for about $100-$150 including monitor, just need a web browser and a little processor like Pentium I.
0
AlexanderAuthor Commented:
nope, it is not this kind of application, i've allready found on the net that kind of things. I don't want to share keyboards to do a kind of "terminal" server with a unique PC, in fact it is a complex architecture needing a "media server" which "spread" input data to other clients but uses too some of the input data, so I need to "centralize" the inputs into one server...
0
AlexanderAuthor Commented:
nobody else has anything to say ??
0
KurtVonCommented:
Nobody has anything to say because James is right.  Just to be absolutely clear, the windows keyboard hook, which is the very next step after drivers, has no parameter for differentiating keyboards: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/keyboardproc.asp

The only way to even tell what keyboards are connected is through the DirectX DirectInput interface: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dninput/html/diov.asp  Keep in mind this whole process is a pain in the neck since Microsoft really didn't think about keyboards as text entry devices when games are involved.  Here's an article on enumerating input devices, including keyboards: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/input/using/usingdirectinput.asp  Note the sample code just stores the last keyboard found rather than all keyboards.

Hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.