> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XInputGetKeystroke

> XInputGetKeystroke

# XInputGetKeystroke

Recupera un evento de entrada del mando.

## Sintaxis

```cpp theme={null}
DWORD XInputGetKeystroke(  
         DWORD dwUserIndex,  
         _Reserved_ dwReserved,  
         XINPUT_KEYSTROKE* pKeystroke  
)  
```

### Parámetros

*dwUserIndex*   \_In\_\
Tipo: DWORD

Índice del jugador con sesión iniciada asociado al dispositivo. Un valor en el intervalo de 0 a XUSER\_MAX\_COUNT - 1; XUSER\_INDEX\_ANY se usa para capturar el siguiente evento de entrada disponible de cualquier usuario.

*dwReserved*   \
Tipo: *Reserved*

Este parámetro no se usa.

*pKeystroke*   \_Out\_\
Tipo: [XINPUT\_KEYSTROKE\*](/reference/input/xinputongameinput/structs/xinput_keystroke)

Puntero a una estructura [XINPUT\_KEYSTROKE](/reference/input/xinputongameinput/structs/xinput_keystroke) que recibe un evento de entrada.

### Valor devuelto

Tipo: DWORD

* Si la función se ejecuta correctamente, devolverá **ERROR\_SUCCESS**.
* Si no se han presionado teclas nuevas, la función devolverá **ERROR\_EMPTY**.
* Si el mando no está conectado o el usuario no lo ha activado, la función devolverá **ERROR\_DEVICE\_NOT\_CONNECTED**; consulte la sección Comentarios a continuación.
* Si la función da error, devolverá un código de error definido en Winerror.h.

## Comentarios

Los mandos inalámbricos no se consideran activos al iniciarse el sistema; si se realiza una llamada a cualquiera de las funciones de XInput antes de que un mando inalámbrico esté activo, esa llamada devolverá **ERROR\_DEVICE\_NOT\_CONNECTED**. Los títulos de juegos deben examinar el código devuelto y estar preparados para controlar esta condición. Los mandos con cable se activan automáticamente cuando se conectan. Los mandos inalámbricos se activan cuando el usuario presiona el botón START o el botón Guía para encender el mando.

Si el código que va a portar de XInput a GameInput no llama a la función GetKeyStroke, puede reducir el tamaño del contenedor de XInput definiendo XINPUT\_ON\_GAMEINPUT\_NO\_XINPUTGETKEYSTROKE. Para obtener más información, consulte [Portabilidad de XInput a GameInput](/build/core-features/common/input/porting/input-porting-xinput#optimizingSection).

## Requisitos

**Encabezado:** XInputOnGameInput.h

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[Portabilidad de XInput a GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XINPUT_KEYSTROKE](/es/reference/input/xinputongameinput/structs/xinput_keystroke.md)
- [XInputOnGameInput](/es/reference/input/xinputongameinput/xinputongameinput_members.md)
- [Portabilidad de XInput a GameInput](/es/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputGetState](/es/reference/input/xinputongameinput/functions/xinputgetstate.md)
- [XInputGetCapabilities](/es/reference/input/xinputongameinput/functions/xinputgetcapabilities.md)
