> ## 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。否則傳回錯誤碼。\
如需錯誤碼的清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

## 備註

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

## 概念文件

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

## 另請參閱

[XAccessibility](/zh-TW/reference/system/xaccessibility/xaccessibility_members)

[XClosedCaptionProperties](/zh-TW/reference/system/xaccessibility/structs/xclosedcaptionproperties)

[XClosedCaptionGetProperties](/zh-TW/reference/system/xaccessibility/functions/xclosedcaptiongetproperties)


## Related topics

- [XClosedCaptionSetEnabled](/reference/system/xaccessibility/functions/xclosedcaptionsetenabled.md)
- [XClosedCaptionGetProperties](/ko/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)
