Skip to main content
IDCompositionTarget::SetRoot method

Sets a visual object as the new root object of a visual tree.

Syntax


HRESULT SetRoot(
  [in, optional]  IDCompositionVisual *visual
);

Parameters

visual [in, optional]

Type: IDCompositionVisual*

The visual object that is the new root of this visual tree. This parameter can be NULL.

Return value

Type: HRESULT

If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. See DirectComposition Error Codes for a list of error codes.

Remarks

A visual can be either the root of a single visual tree, or a child of another visual, but it cannot be both at the same time. This method fails if the visual parameter is already the root of another visual tree, or is a child of another visual.

If visual is NULL, the visual tree is empty. If there was a previous non-NULL root visual, that visual becomes available for use as the root of another visual tree, or as a child of another visual.

Examples

For an example, see How to Build a Simple Visual Tree.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Dcomp.h

Library

Dcomp.lib

DLL

Dcomp.dll

See also

IDCompositionDevice::CreateVisual
IDCompositionTarget