IDXGIFactory::EnumAdapters method

Enumerates the adapters (video cards).

Syntax


HRESULT EnumAdapters(
  [in]   UINT Adapter,
  [out]  IDXGIAdapter **ppAdapter
);

Parameters

Adapter [in]

Type: UINT

The index of the adapter to enumerate.

ppAdapter [out]

Type: IDXGIAdapter**

The address of a pointer to an IDXGIAdapter interface at the position specified by the Adapter parameter. This parameter must not be NULL.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns DXGI_ERROR_NOT_FOUND if the index is greater than or equal to the number of adapters in the local system, or DXGI_ERROR_INVALID_CALL if ppAdapter parameter is NULL.

Remarks

When you create a factory, the factory enumerates the set of adapters that are available in the system. Therefore, if you change the adapters in a system, you must destroy and recreate the IDXGIFactory object. The number of adapters in a system changes when you add or remove a display card, or dock or undock a laptop.

When the EnumAdapters method succeeds and fills the ppAdapter parameter with the address of the pointer to the adapter interface, EnumAdapters increments the adapter interface's reference count. When you finish using the adapter interface, call the Release method to decrement the reference count before you destroy the pointer.

EnumAdapters first returns the adapter with the output on which the desktop primary is displayed. This adapter corresponds with an index of zero. EnumAdapters next returns other adapters with outputs. EnumAdapters finally returns adapters without outputs.

Windows Phone 8: This API is supported.

Examples

Enumerating Adapters

The following code example demonstrates how to enumerate adapters using the EnumAdapters method.



UINT i = 0; 
IDXGIAdapter * pAdapter; 
std::vector <IDXGIAdapter*> vAdapters; 
while(pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND) 
{ 
	vAdapters.push_back(pAdapter); 
	++i; 
} 


Requirements

Header

DXGI.h

Library

DXGI.lib

See also

IDXGIFactory
DXGI Interfaces

 

 

Community Additions

ADD
Show:
© 2014 Microsoft