> ## 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::SendGamepadReport Method

> IXtfInputClient::SendGamepadReport Method

# IXtfInputClient::SendGamepadReport Method

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

<a id="syntaxSection" />

## 语法

```cpp theme={null}
public:
HRESULT SendGamepadReport(
         UINT64 controllerId,
         GAMEPAD_REPORT report
)  
```

<a id="ID4EG" />

### 参数

*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

要报告的控制器状态

<a id="ID4EP" />

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

<a id="remarks" />

## 备注

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

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

<a id="requirements" />

## 要求

**头文件：** xtfinput.h

**库：** xtfinput.lib

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

## 另请参阅

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


## Related topics

- [IXtfInputClient::SendGamepadReportEx](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportex.md)
- [IXtfInputClient::SendGamepadReportWithAudio](/zh-CN/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportwithaudio.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)
