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

# XClosedCaptionSetEnabled

> XClosedCaptionSetEnabled

# XClosedCaptionSetEnabled

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

## 構文

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

### パラメーター

*enabled*   \_In\_\
型: bool

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

### 戻り値

型: HRESULT

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

## 解説

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

この関数を成功させるには、クローズド キャプションを有効にする必要があります。
ユーザーがゲーム タイトルの 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](/reference/system/xaccessibility/xaccessibility_members)

[XClosedCaptionProperties](/reference/system/xaccessibility/structs/xclosedcaptionproperties)

[XClosedCaptionGetProperties](/reference/system/xaccessibility/functions/xclosedcaptiongetproperties)


## Related topics

- [XClosedCaptionGetProperties](/ja-jp/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)
- [XSpeechToTextSetPositionHint](/ja-jp/reference/system/xaccessibility/functions/xspeechtotextsetpositionhint.md)
- [XHighContrastGetMode](/ja-jp/reference/system/xaccessibility/functions/xhighcontrastgetmode.md)
- [XSpeechToTextSendString](/ja-jp/reference/system/xaccessibility/functions/xspeechtotextsendstring.md)
- [XAG 104: 字幕とキャプション](/ja-jp/build/game-principles/accessibility/xag-deep-dives/xag-104-subtitles-captions.md)
