Hello there!
For an installation project I need to distinguish between 4 different SpaceNavigators plugged in. So far in SDK I've found no way of figuring out from which device does the SiSpwEvent come from. How can I figure that out?
Thanks a bunch in advance!
Need to use 4 devices via Windows SDK at a time. Help!
Moderator: Moderators
Re: Need to use 4 devices via Windows SDK at a time. Help!
I have tried modifying 3DxTest this way:
(in accordance with the info frome here: https://www.3dconnexion.com/forum/viewt ... 8&start=15)
but I still get events from both devices.
Code: Select all
int num = SiGetNumDevices();
SiDevID devIndex1 = SiDeviceIndex(1);
SiDevID devIndex2 = SiDeviceIndex(2);
if ( (devHdl = SiOpen ("3DxTest32", /*SI_ANY_DEVICE*/devIndex2, SI_NO_MASK, SI_EVENT, &oData)) == NULL)
but I still get events from both devices.
Re: Need to use 4 devices via Windows SDK at a time. Help!
Moving post to Developer Forum.
Uta
3Dconnexion
3Dconnexion
Re: Need to use 4 devices via Windows SDK at a time. Help!
This is how you open multiple devices (from our puzzle demo):
Then when you get a windows message, you have to figure out which device generated it.
You use each hdl to communicate with each device.
The events from each device arrive separately:
(again from puzzle)
If the driver is installed, you will always have at least one "device". Even if there are no actual physical 3D mice attached to the user's machine, you will have a device that will send you notifications if a user plugs a device in while your application is running.
Code: Select all
...
SiInitialize ();
numDevices = SiGetNumDevices();
for(int devID = 0; devID <= numDevices; devID++)
{
SiOpenWinInit (&oData, Spw_hWndMain);
devHdls[devID] = SiOpen ("puzzle", devID, SI_NO_MASK, SI_EVENT, &oData);
SiGetDeviceInfo(devHdls[devID], &devInfos[devID]);
...
You use each hdl to communicate with each device.
The events from each device arrive separately:
(again from puzzle)
Code: Select all
// Loop through all the devices.
// Use the first for view control.
// The others for object control.
SiGetEventWinInit (&eData, msg.message, msg.wParam, msg.lParam);
for(int devID=0; devID <= MAX_DEVICE_INDEX; devID++)
{
if (devHdls[devID] != SI_NO_HANDLE)
{
if (SiGetEvent (devHdls[devID], 0, &eData, &event) == SI_IS_EVENT)
{
...
Re: Need to use 4 devices via Windows SDK at a time. Help!
Thanks for reply!
Where do I get the puzzle demo? Current SDK doesn't seem to have it anymore.
Where do I get the puzzle demo? Current SDK doesn't seem to have it anymore.
Re: Need to use 4 devices via Windows SDK at a time. Help!
Ok, I have tried what you suggested and I still have both controllers' messages on the handle that I've used the last.
I've read through this thread: https://www.3dconnexion.com/forum/viewt ... 19&t=15981
Heisters had the same problem as me, but in my case it wasn't fixed by calling on the both handles.
What do I do next?
I've read through this thread: https://www.3dconnexion.com/forum/viewt ... 19&t=15981
Heisters had the same problem as me, but in my case it wasn't fixed by calling
Code: Select all
SiGrabDevice( device.handle, SPW_TRUE )
What do I do next?
Re: Need to use 4 devices via Windows SDK at a time. Help!
Sign up as a developer, then you can send me your sample code.
That other thread was about applications which have a window that is hidden (it never gets focus).
You need to have one SiHdl for every device you want to get input from.
Sorry, we don't normally distribute the puzzle src code. It was never cleaned for outside consumption. And I don't want to embarrass myself
I may modify the 3DxTest sample code.
That other thread was about applications which have a window that is hidden (it never gets focus).
You need to have one SiHdl for every device you want to get input from.
Sorry, we don't normally distribute the puzzle src code. It was never cleaned for outside consumption. And I don't want to embarrass myself
I may modify the 3DxTest sample code.
Re: Need to use 4 devices via Windows SDK at a time. Help!
I believe you have found a bug in the driver illuminated by the structure of 3DxTest.
To work around it, don't display the application's window until after opening the devices.
It should be fixed in the next release.
Thanks for finding it.
To work around it, don't display the application's window until after opening the devices.
It should be fixed in the next release.
Thanks for finding it.