How to detect whether the devices are plugged/unplugged?
Moderator: Moderators
Simple way is to follow the cord to the end if you see the end of the usb its not plugged in.
Otherwise go to system and check if windows detects the device under human interface if not its either not plugged in or windows isnt detecting the device.
If you go task manager, processes you can see if the 3DXsrv.exe is running if so the device is plugged in otherwise the driver wont launch at bootup if its not plugged in.

Otherwise go to system and check if windows detects the device under human interface if not its either not plugged in or windows isnt detecting the device.
If you go task manager, processes you can see if the 3DXsrv.exe is running if so the device is plugged in otherwise the driver wont launch at bootup if its not plugged in.
We are not using Raw Input currently. We register the message SpaceWareMessage00 and handle it.
As I understand it, the Raw Input is about how to handle the message. Dose connecting/disconnecting the device send any message that can only be handled by Raw Input.
My requirement is that open our product, show/hide the button for 3dconnexion if the device is connected/disconnected, and some time after that, if the device is disconnected/conntected, hide/show that button immediately. My original thought is that there may be a API to return that status. As you mentioned Raw Input here, I wonder whether it send some message when connecting/disconnecting the device, and i can read the status in the message handler.
Thank you for your help.
As I understand it, the Raw Input is about how to handle the message. Dose connecting/disconnecting the device send any message that can only be handled by Raw Input.
My requirement is that open our product, show/hide the button for 3dconnexion if the device is connected/disconnected, and some time after that, if the device is disconnected/conntected, hide/show that button immediately. My original thought is that there may be a API to return that status. As you mentioned Raw Input here, I wonder whether it send some message when connecting/disconnecting the device, and i can read the status in the message handler.
Thank you for your help.
You can register for device notification messages. These will tell you when devices connect and disconnect (WM_DEVICECHANGE events).
The next version of 3DxWare (version 7) will also forward these events to your SpaceWareMessage00 window.
You only need to initialized Raw Input once though. If there are ever any devices attached and something happens on one of them you will just get the data. No reason not to set it up. No harm. No foul.
The next version of 3DxWare (version 7) will also forward these events to your SpaceWareMessage00 window.
You only need to initialized Raw Input once though. If there are ever any devices attached and something happens on one of them you will just get the data. No reason not to set it up. No harm. No foul.
You need the HID GUID:
GUID hidGuid;
HidD_GetHidGuid (&hidGuid);
DEV_BROADCAST_DEVICEINTERFACE filterData;
ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
filterData.dbcc_classguid = hidGuid;
ghDevNotify = RegisterDeviceNotification( (HANDLE)ghwndDevNotify,
&filterData, DEVICE_NOTIFY_WINDOW_HANDLE );
GUID hidGuid;
HidD_GetHidGuid (&hidGuid);
DEV_BROADCAST_DEVICEINTERFACE filterData;
ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
filterData.dbcc_classguid = hidGuid;
ghDevNotify = RegisterDeviceNotification( (HANDLE)ghwndDevNotify,
&filterData, DEVICE_NOTIFY_WINDOW_HANDLE );
Calling the function HidD_GetHidGuid() requires installing the DDK. So i think it costs too much to implement the functionality in this way that asks all developers to install DDk and makes the application independ on the library.
Is this the only way to get the status? And When will the versin 7 been released?
Is this the only way to get the status? And When will the versin 7 been released?
I'd be willing to make a small wager that the GUID is a constant. You could run it once in a test program and save it. It might even be found in inf files.
OTOH, the DDK is the "Microsoft Way". Not installing it may be the same as not installing the 3Dx SDK. I don't know what else you are missing.
If you have a lot of existing 3DxWare SDK code (Si* functions), it might be simpler to wait for 3Dx7 (in internal beta now, external beta soon). OTOH, 3DxInput (COM server) is deprecated and there are not plans to add any 3Dx7 functionality to it. We are highly recommending that ISV convert to Raw Input.
OTOH, the DDK is the "Microsoft Way". Not installing it may be the same as not installing the 3Dx SDK. I don't know what else you are missing.
If you have a lot of existing 3DxWare SDK code (Si* functions), it might be simpler to wait for 3Dx7 (in internal beta now, external beta soon). OTOH, 3DxInput (COM server) is deprecated and there are not plans to add any 3Dx7 functionality to it. We are highly recommending that ISV convert to Raw Input.
Sorry. There aren't any inf files in the version you have. You don't need GUIDs for individual devices, you need the HID GUID. Your notifications don't come from devices.
Install the DDK.
OTOH, it looks like the HID GUID is: {4D1E55B2-F16F-11CF-88CB-001111000030}. This was from W7, x86. I have no idea if it is the same on all platforms. We always look it up with the code I gave you.
Install the DDK. Anything else is unsupported.
Install the DDK.
Install the DDK.
OTOH, it looks like the HID GUID is: {4D1E55B2-F16F-11CF-88CB-001111000030}. This was from W7, x86. I have no idea if it is the same on all platforms. We always look it up with the code I gave you.
Install the DDK. Anything else is unsupported.
Install the DDK.