// Get the first adapter IDXGIAdapter* adapter; DXGI_FACTORY->EnumAdapters(0, &adapter); // Enumerate its outputs IDXGIOutput* output; UINT i = 0; while (adapter->EnumOutputs(i, &output) != DXGI_ERROR_NOT_FOUND) { // Do something with the output, like getting its description DXGI_OUTPUT_DESC desc; output->GetDesc(&desc); // Release the output output->Release(); i++; } // Release the adapter adapter->Release();
// Loop through all adapters and their outputs IDXGIAdapter* adapter; IDXGIOutput* output; UINT i = 0; while (DXGI_FACTORY->EnumAdapters(i, &adapter) != DXGI_ERROR_NOT_FOUND) { UINT j = 0; while (adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND) { // Do something with the output // Release the output output->Release(); j++; } // Release the adapter adapter->Release(); i++; }This example loops through all the available adapters and their outputs in nested loops using the DXGI_FACTORY->EnumAdapters and IDXGIAdapter EnumOutputs methods. For each output, it can perform some operation and then releases it. Finally, it releases the adapter. Package library: DXGI.lib In summary, IDXGIAdapter EnumOutputs is a useful DirectX API for accessing information about the available outputs of a graphics adapter. The above C++ code examples demonstrate how to use the method to enumerate the outputs of an adapter and perform some task on each output. The DXGI.lib is the package library needed to link the DXGIAdapter EnumOutputs function in a C++ project.