> ## 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 方法

> IXtfInputClient::SendGamepadReport 方法

# IXtfInputClient::SendGamepadReport 方法

將控制器狀態報告傳送至主機。

<a id="syntaxSection" />

## 語法

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

<a id="ID4EG" />

### 參數

*controllerId*\
類型：UINT64

此 [IXtfInputClient](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/ixtfinputclient-xtfinput-xbox-windows-t) 的裝置識別碼。\
控制器識別碼是 [IXtfInputClient::ConnectGamepad](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) 所傳回的控制器識別碼。

*report*\
類型：GAMEPAD\_REPORT

要回報的控制器狀態

<a id="ID4EP" />

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

<a id="remarks" />

## 備註

**SendGameReport** 方法會將以 [GAMEPAD\_REPORT](/zh-TW/reference/tools/xtf/xtfinput/structures/GAMEPAD_REPORT-xtfinput-xbox-windows-t) 表示的控制器狀態，傳送至由 [IXtfInputClient::ConnectGamepad](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) 建立的虛擬控制器。您需要傳送多個狀態，才能模擬單次按下並放開按鈕。若要模擬按下按鈕，請在 [GAMEPAD\_REPORT.Buttons](/zh-TW/reference/tools/xtf/xtfinput/structures/GAMEPAD_REPORT-xtfinput-xbox-windows-t) 中設定適當的旗標並呼叫 **SendGamepadReport**，然後將 [GAMEPAD\_REPORT.Buttons](/zh-TW/reference/tools/xtf/xtfinput/structures/GAMEPAD_REPORT-xtfinput-xbox-windows-t) 設定為 [GAMEPAD\_BUTTONS::NONE](/zh-TW/reference/tools/xtf/xtfinput/enumerations/GAMEPAD_BUTTONS-typedef-xtfinput-xbox-windows-t) 並再次呼叫 **SendGamepadReport**。

**SendGamepadReport** 可以 60Hz 的頻率呼叫，以模擬來自實體控制器的資料。

<a id="requirements" />

## 需求

**標頭：** xtfinput.h

**程式庫：** xtfinput.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

## 另請參閱

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


## Related topics

- [IXtfInputClient::SendGamepadReportEx](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportex.md)
- [IXtfInputClient::SendGamepadReportWithAudio](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportwithaudio.md)
- [IXtfInputClient::ConnectGamepad 方法](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::DisconnectGamepad 方法](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectgamepad-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::DisconnectAllGamepads 方法](/zh-TW/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectallgamepads-ixtfinputclient-xtfinput-xbox-windows-m.md)
