How To: Get Adapter Display Modes
This topic shows how to use Microsoft DirectX Graphics Infrastructure (DXGI) to get the valid display modes associated with an adapter. DirectX 10 and 11 can use DXGI to get the valid display modes. Knowing the valid display modes ensures that your application can properly choose a valid full-screen mode.
To get adapter display modes
Create an IDXGIFactory object and use it to enumerate the available adapters. For more information, see How To: Enumerate Adapters.
Call IDXGIAdapter::EnumOutputs to enumerate the outputs for each adapter.
IDXGIOutput* pOutput = NULL; HRESULT hr; hr = pAdapter->EnumOutputs(0,&pOutput);
Call IDXGIOutput::GetDisplayModeList to retrieve an array of DXGI_MODE_DESC structures and the number of elements in the array. Each DXGI_MODE_DESC structure represents a valid display mode for the output.
UINT numModes = 0; DXGI_MODE_DESC* displayModes = NULL; DXGI_FORMAT format = DXGI_FORMAT_R32G32B32A32_FLOAT; // Get the number of elements hr = pOutput->GetDisplayModeList( format, 0, &numModes, NULL); displayModes = new DXGI_MODE_DESC[numModes]; // Get the list hr = pOutput->GetDisplayModeList( format, 0, &numModes, displayModes);
Related topics