Partager via


XClosedCaptionSetEnabled

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

Syntax

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.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

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.

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

See also

XAccessibility

XClosedCaptionProperties

XClosedCaptionGetProperties