> ## 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.

# IXtfInputClient::SendGamepadReportEx

> IXtfInputClient::SendGamepadReportEx

# IXtfInputClient::SendGamepadReportEx

向主机发送控制器状态报告。

## 语法

```cpp theme={null}
HRESULT SendGamepadReportEx(  
         UINT64 controllerId,  
         GAMEPAD_REPORT_EX report  
)  
```

### 参数

*controllerId*   \
类型：UINT64

此 [IXtfInputClient](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/ixtfinputclient-xtfinput-xbox-windows-t) 的设备标识符。\
该控制器 ID 是 [IXtfInputClient::ConnectGamepad](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) 返回的控制器 ID。

*report*   \
类型：[GAMEPAD\_REPORT\_EX](/reference/tools/xtf/xtfinput/structures/gamepad_report_ex)

要报告的控制器状态。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

## 备注

**SendGameReportEx** 方法将由 [GAMEPAD\_REPORT\_EX](/reference/tools/xtf/xtfinput/structures/gamepad_report_ex) 表示的控制器状态发送到由 [IXtfInputClient::ConnectGamepad](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) 创建的虚拟控制器。要模拟单次按钮按下和释放，需要发送多个状态。要模拟按钮按下，请在 [GAMEPAD\_REPORT\_EX.Buttons](/reference/tools/xtf/xtfinput/structures/gamepad_report_ex) 中设置相应标志的情况下调用 **SendGamepadReportEx**，然后在将 [GAMEPAD\_REPORT\_EX.Buttons](/reference/tools/xtf/xtfinput/structures/gamepad_report_ex) 设置为 [GAMEPAD\_BUTTONS::NONE](/reference/tools/xtf/xtfinput/enumerations/GAMEPAD_BUTTONS-typedef-xtfinput-xbox-windows-t) 的情况下再次调用 **SendGamepadReportEx**。

可以以 60Hz 频率调用 **SendGamepadReportEx** 来模拟来自物理控制器的数据。

## 要求

**头文件：** XtfInput.h

**库：** xtfinput.lib

**支持的平台：** Windows（用于 XBOX 主机工具）

## 另请参阅

[XtfInput](/reference/tools/xtf/xtfinput/xtfinput-xbox-microsoft-n)\
[GAMEPAD\_REPORT\_EX](/reference/tools/xtf/xtfinput/structures/gamepad_report_ex)\
[IXtfInputClient::ConnectGamepad](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m)


## Related topics

- [IXtfInputClient::SendGamepadReportWithAudio](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportwithaudio.md)
- [IXtfInputClient::SendGamepadReport Method](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/sendgamepadreport-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::ConnectGamepad Method](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::DisconnectGamepad Method](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectgamepad-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::DisconnectAllGamepads Method](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectallgamepads-ixtfinputclient-xtfinput-xbox-windows-m.md)
