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

# IGameInput::EnableBackgroundInput

> アプリケーションがバックグラウンドにある間の入力の配信を有効または無効にします。

アプリケーションがバックグラウンドにある間の入力の配信を有効または無効にします。

## 構文

```cpp theme={null}
void EnableBackgroundInput(
    bool enable
);
```

### パラメーター

*enable*   \_In\_\
型: bool

アプリケーションにフォーカスがない間も入力を受け取る場合は `true`、アプリケーションにフォーカスがある間のみ入力を受け取る場合は `false`。

### 戻り値

型: void

このメソッドは値を返しません。

## 解説

既定では、GameInput は、アプリケーションがフォアグラウンドにありフォーカスがある間にのみ、そのアプリケーションに入力を配信します。別のアプリケーションにフォーカスがある間も入力を受け取るには、`EnableBackgroundInput(true)` を呼び出します。バックグラウンド入力は、[IGameInputReading::GetSystemButtonState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getsystembuttonstate.md) を通じて報告される Guide と Share のシステム ボタンを含め、すべての入力の種類に一度に適用されます。既定の動作に戻すには、`EnableBackgroundInput(false)` を呼び出します。

この設定は主に Windows に関係します。Windows では複数のアプリケーションを並行して実行でき、フォーカスがアプリケーション間で移動する可能性があるためです。

このメソッドは、以前のバージョンの GameInput の [IGameInput::SetFocusPolicy](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_setfocuspolicy.md) メソッドと [GameInputFocusPolicy](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/enums/gameinputfocuspolicy.md) 列挙型を置き換えるものです。他のプロセスが入力を受け取れないようにする排他的フォアグラウンド ポリシーは、GameInput v4 では利用できません。

PC では、GameInput ランタイムがシステムにインストールされておらず、アプリケーションと共にサイドロードされている場合、バックグラウンド入力の有効化は無視されます。詳細については、「[GameInput のサイドロード](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-agility-redistributable.md)」を参照してください。

> [!NOTE]
>
> 多くのユーザーは、Guide ボタンをメニューに、Share ボタンをスクリーンショットに使用するオーバーレイ アプリケーションを実行しています。アプリケーションがバックグラウンドにある間にシステム ボタンを処理する必要があるかどうかを検討してください。

## 要件

**ヘッダー:** GameInput.h

**ライブラリ:** gameinput.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[GameInput の基礎](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-fundamentals.md)\
[GameInput のサイドロード](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-agility-redistributable.md)\
[IGameInput](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinput/igameinput.md)\
[IGameInput::SetFocusPolicy (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_setfocuspolicy.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 導入されました。 |


## Related topics

- [IGameInput::SetFocusPolicy (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_setfocuspolicy.md)
- [IGameInputReading::GetSystemButtonState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getsystembuttonstate.md)
- [GameInputFocusPolicy (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/enums/gameinputfocuspolicy.md)
- [非推奨の GameInput API メンバー](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/gameinput_deprecated_members.md)
- [GameInput のサイドロード](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-agility-redistributable.md)
