XInputEnable function (xinput.h)
Sets the reporting state of XInput.
void XInputEnable( [in] BOOL enable );
If enable is FALSE, XInput will only send neutral data in response to XInputGetState (all buttons up, axes centered, and triggers at 0). XInputSetState calls will be registered but not sent to the device. Sending any value other than FALSE will restore reading and writing functionality to normal.
This function is meant to be called when an application gains or loses focus (such as via WM_ACTIVATEAPP). Using this function, you will not have to change the XInput query loop in your application as neutral data will always be reported if XInput is disabled.
In a controller that supports vibration effects:
- Passing FALSE will stop any vibration effects currently playing. In this state, calls to XInputSetState will be registered, but not passed to the device.
- Passing TRUE will pass the last vibration request (even if it is 0) sent to XInputSetState to the device.
Windows 10 or later: Deprecated, as game controller input is automatically enabled/disabled by the system based on the application window focus.