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

# XInputOnGameInputInitialize

> XInputOnGameInputInitialize

# XInputOnGameInputInitialize

初始化 XInput 包裝函式 API。

## 語法

```cpp theme={null}
HRESULT XInputOnGameInputInitialize(  
)  
```

### 參數

### 傳回值

類型：HRESULT

函式的結果。

## 備註

若要使用此函式，您必須定義 `XINPUT_ON_GAMEINPUT_EXPLICIT_INITIALIZATION` 巨集。根據預設，XInput 會在背景中初始化，這會導致第一次呼叫 XInput 函式時花費明顯較多的時間，因為該呼叫會與初始化工作綁在一起。`XINPUT_ON_GAMEINPUT_EXPLICIT_INITIALIZATION` 可讓您更精細地控制 XInput 的初始化和取消初始化。若要深入了解並查看明確初始化的優點，請閱讀[從 XInput 移植到 GameInput](/zh-TW/build/core-features/common/input/porting/input-porting-xinput#optimizingSection)。

## 需求

**標頭：** XInputOnGameInput.h

**程式庫：** xgameruntime.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[將 XInput 移植到 GameInput](/zh-TW/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/zh-TW/reference/input/xinputongameinput/xinputongameinput_members)\
[XInputOnGameInputUninitialize](/zh-TW/reference/input/xinputongameinput/functions/xinputongameinputuninitialize)


## Related topics

- [XInputOnGameInputInitialize](/reference/input/xinputongameinput/functions/xinputongameinputinitialize.md)
- [XInputOnGameInputUninitialize](/reference/input/xinputongameinput/functions/xinputongameinputuninitialize.md)
- [XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members.md)
