> ## 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/zh-TW/reference/errorcodes.md)。

## 備註

> [!NOTE]
>
> 在時間敏感執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感執行緒](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 主機

## 概念文件

* [時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

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

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

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


## Related topics

- [XClosedCaptionGetProperties](https://docs.xbox.com/zh-TW/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)
- [XSpeechToTextSetPositionHint](https://docs.xbox.com/zh-TW/reference/system/xaccessibility/functions/xspeechtotextsetpositionhint.md)
- [XHighContrastGetMode](https://docs.xbox.com/zh-TW/reference/system/xaccessibility/functions/xhighcontrastgetmode.md)
- [XSpeechToTextSendString](https://docs.xbox.com/zh-TW/reference/system/xaccessibility/functions/xspeechtotextsendstring.md)
- [Xbox 無障礙指南 104](https://docs.xbox.com/zh-TW/build/game-principles/accessibility/xag-deep-dives/xag-104-subtitles-captions.md)
