You can do so by using the gamepad_ functions - these allow for up to 4 XInput gamepads and up to 8 DirectInput gamepads, 12 total.
gamepad_