XInputEnable function

Sets the reporting state of XInput.


void XInputEnable(
  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.

Return Value

This function does not return a value.


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.

Platform Requirements

Windows 8 (XInput 1.4), DirectX SDK (XInput 1.3)


Target Platform Windows
Header xinput.h
Library Xinput.lib
DLL Xinput1_4.dll

See Also



XInput Functions