MMSYSTEM sends a JDD_GETNUMDEVS message to your driver to determine how many devices your driver supports. The lParam1 and lParm2 parameters are not used with this message. In response to the JDD_GETNUMDEVS message, return the maximum number of devices supported by your driver.
Your driver should return the number of supported devices, which is not necessarily the same as the number of connected devices. This lets a user connect a device after the driver has been loaded. The joystick interface provides a JOYERR_UNPLUGGED error value that you should return when an application polls an unplugged device. For example, the IBMJOY.DRV driver returns 2 in response to this message, regardless of the number of joysticks actually connected to the adapter.