directInput using two mouse

Recommended Posts

lomateron    491

I have this:

din->EnumDevices(DI8DEVCLASS_POINTER,DIEnumDevicesCallback,NULL,DIEDFL_ATTACHEDONLY);


and this:

GUID gUID[2];

BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi,LPVOID pvRef)
{
if(numMice<2)
{
gUID[numMice]=lpddi->guidInstance;
numMice++;
}
return DIENUM_CONTINUE;
}


then I attach two mouses to my computer and it only counts one(The numMice variable goes to 1). WHY?
Inside the app the input of the two mice are combined.

The two mouses work correctly in windows 7 OS.
Edited by lomateron

Share on other sites
Digivance    1724

Going out on a limb here but are you sure it's possible to make distinctions between two mice?  I have zero experience with this and may be wrong here but my understanding is that the computer can listen from multiple "mouse" devices but it all get's "lost in translation" if you will.  That is to say that when you respond to a "mouse event" you are responding to that event from any mouse or touch pad on the system not so much one or the other.  There is a lot of room for me to be wrong here but maybe you don't see two mice because the computer doesn't really have two mice?  It has two different input devices that act as a single "mouse" where either of their inputs cause the same events?

Had to find some more on this, yes it appears that DirectX (or Direct Input to me more correct) as of version 9.0 no longer differentiates between multiple mice.

and

Edited by Dan Mayor

Share on other sites
lomateron    491

Here is the solution for that