# joyGetNumDevs Function

`Declare Function joyGetNumDevs Lib "winmm.dll" () As Long`

joyGetNumDevs returns the number of joysticks that are configured under Windows's Control Panel. This doesn't necessarily mean that all of them are connected and in working order, but there could be. The best way to see if a joystick is working is to call joyGetDevCaps and check for a return value of 0.

Example:

    ' Read number of possible joysticks
    x = joyGetNumDevs()
    Debug.Print "There could be up to"; x; "joysticks."

Category: Joysticks
Back to the index.