IDXGIAdapter::EnumOutputs method (dxgi.h)

Enumerate adapter (video card) outputs.

Syntax

HRESULT EnumOutputs(
        UINT        Output,
  [out] IDXGIOutput **ppOutput
);

Parameters

Output

Type: UINT

The index of the output.

[out] ppOutput

Type: IDXGIOutput**

The address of a pointer to an IDXGIOutput interface at the position specified by the Output parameter.

Return value

Type: HRESULT

A code that indicates success or failure (see DXGI_ERROR). DXGI_ERROR_NOT_FOUND is returned if the index is greater than the number of outputs.

If the adapter came from a device created using D3D_DRIVER_TYPE_WARP, then the adapter has no outputs, so DXGI_ERROR_NOT_FOUND is returned.

Remarks

Note  If you call this API in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE.
 
When the EnumOutputs method succeeds and fills the ppOutput parameter with the address of the pointer to the output interface, EnumOutputs increments the output interface's reference count. To avoid a memory leak, when you finish using the output interface, call the Release method to decrement the reference count.

EnumOutputs first returns the output on which the desktop primary is displayed. This output corresponds with an index of zero. EnumOutputs then returns other outputs.

Examples

Enumerating Outputs

Here is an example of how to use EnumOutputs to enumerate all the outputs on an adapter:


UINT i = 0;
IDXGIOutput * pOutput;
std::vector<IDXGIOutput*> vOutputs;
while(pAdapter->EnumOutputs(i, &pOutput) != DXGI_ERROR_NOT_FOUND)
{
    vOutputs.push_back(pOutput);
    ++i;
}

Requirements

Requirement Value
Target Platform Windows
Header dxgi.h
Library DXGI.lib

See also

DXGI Interfaces

IDXGIAdapter