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

Sets a Boolean value that indicates if closed captions are enabled or disabled.

## Syntax

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

### Parameters

*enabled*   \_In\_\
Type: bool

A Boolean value indicating if closed captions are enabled or disabled.

### Return value

Type: HRESULT

HRESULT if successful.  Otherwise, returns an error code.\
For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

For this function to be successful, closed captions must be enabled.
The user must enable the closed captions feature in the UI of the Game title.

To flag closed captions as enabled, set *enabled* to true or 1.
To flag closed captions as disabled, set *enabled* to false or 0.

The following example demonstrates how to enable closed captions programmatically.

```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
}
```

## Requirements

**Header:** XAccessibility.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

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

## See also

[XAccessibility](/reference/system/xaccessibility/xaccessibility_members)

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

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


## Related topics

- [XClosedCaptionGetProperties](/reference/system/xaccessibility/functions/xclosedcaptiongetproperties.md)
- [XSpeechToTextSetPositionHint](/reference/system/xaccessibility/functions/xspeechtotextsetpositionhint.md)
- [XHighContrastGetMode](/reference/system/xaccessibility/functions/xhighcontrastgetmode.md)
- [XSpeechToTextSendString](/reference/system/xaccessibility/functions/xspeechtotextsendstring.md)
- [XAG 104: Subtitles and captions](/build/game-principles/accessibility/xag-deep-dives/xag-104-subtitles-captions.md)
