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

# XClosedCaptionSetEnabled

> XClosedCaptionSetEnabled

# XClosedCaptionSetEnabled

クローズド キャプションが有効か無効かを示すブール値を設定します。

## 構文

```cpp theme={null}
HRESULT XClosedCaptionSetEnabled(  
         bool enabled  
)  
```

### パラメーター

*enabled*   \_In\_\
型: bool

クローズド キャプションが有効か無効かを示すブール値です。

### 戻り値

型: HRESULT

成功した場合は HRESULT。 それ以外の場合はエラー コードを返します。\
エラー コードの一覧については、「[エラー コード](https://docs.xbox.com/ja-jp/reference/errorcodes.md)」を参照してください。

## 解説

> [!NOTE]
>
> この関数は、時間依存スレッドで呼び出しても安全ではありません。 詳細については、「[Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)」を参照してください。

この関数を成功させるには、クローズド キャプションを有効にする必要があります。
ユーザーがゲーム タイトルの UI でクローズド キャプション機能を有効にする必要があります。

クローズド キャプションが有効であることを示すには、*enabled* を true または 1 に設定します。
クローズド キャプションが無効であることを示すには、*enabled* を false または 0 に設定します。

次の例は、プログラムでクローズド キャプションを有効にする方法を示しています。

```cpp theme={null}
//The user must first enable closed captions in the UI of the Game title. Afterwards, the game title can set the Boolean flag.
if (SUCCEEDED(XClosedCaptionsSetEnabled(true)))
{
    // Closed captions successfully enabled
}
```

## 要件

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

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

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

## 概念ドキュメント

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 関連項目

[XAccessibility](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/xaccessibility_members.md)

[XClosedCaptionProperties](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/structs/xclosedcaptionproperties.md)

[XClosedCaptionGetProperties](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)


## Related topics

- [XClosedCaptionGetProperties](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)
- [XSpeechToTextSetPositionHint](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextsetpositionhint.md)
- [XSpeechToTextSendString](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xspeechtotextsendstring.md)
- [XHighContrastGetMode](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/functions/xhighcontrastgetmode.md)
- [XBOX Accessibility Guideline 104](https://docs.xbox.com/ja-jp/build/game-principles/accessibility/xag-deep-dives/xag-104-subtitles-captions.md)
