QueryDisplayConfig function (winuser.h)
The QueryDisplayConfig function retrieves information about all possible display paths for all display devices, or views, in the current setting.
LONG QueryDisplayConfig( UINT32 flags, UINT32 *numPathArrayElements, DISPLAYCONFIG_PATH_INFO *pathArray, UINT32 *numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO *modeInfoArray, DISPLAYCONFIG_TOPOLOGY_ID *currentTopologyId );
The type of information to retrieve. The value for the Flags parameter must be one of the following values.
All the possible path combinations of sources to targets.
Currently active paths only.
Active path as defined in the CCD database for the currently connected displays.
Pointer to a variable that contains the number of elements in pPathInfoArray. This parameter cannot be NULL. If QueryDisplayConfig returns ERROR_SUCCESS, pNumPathInfoElements is updated with the number of valid entries in pPathInfoArray.
Pointer to a variable that contains an array of DISPLAYCONFIG_PATH_INFO elements. Each element in pPathInfoArray describes a single path from a source to a target. The source and target mode information indexes are only valid in combination with the pmodeInfoArray tables that are returned for the API at the same time. This parameter cannot be NULL. The pPathInfoArray is always returned in path priority order. For more information about path priority order, see Path Priority Order.
Pointer to a variable that specifies the number in element of the mode information table. This parameter cannot be NULL. If QueryDisplayConfig returns ERROR_SUCCESS, pNumModeInfoArrayElements is updated with the number of valid entries in pModeInfoArray.
Pointer to a variable that contains an array of DISPLAYCONFIG_MODE_INFO elements. This parameter cannot be NULL.
Pointer to a variable that receives the identifier of the currently active topology in the CCD database. For a list of possible values, see the DISPLAYCONFIG_TOPOLOGY_ID enumerated type.
The pCurrentTopologyId parameter is only set when the Flags parameter value is QDC_DATABASE_CURRENT.
If the Flags parameter value is set to QDC_DATABASE_CURRENT, the pCurrentTopologyId parameter must not be NULL. If the Flags parameter value is not set to QDC_DATABASE_CURRENT, the pCurrentTopologyId parameter value must be NULL.
The function returns one of the following return codes.
||The function succeeded.|
||The combination of parameters and flags that are specified is invalid.|
||The system is not running a graphics driver that was written according to the Windows Display Driver Model (WDDM). The function is only supported on a system with a WDDM driver running.|
||The caller does not have access to the console session. This error occurs if the calling process does not have access to the current desktop or is running on a remote session.|
||An unspecified error occurred.|
||The supplied path and mode buffer are too small.|
As the GetDisplayConfigBufferSizes function can only determine the required array size at a particular moment in time, it is possible that between calls to GetDisplayConfigBufferSizes and QueryDisplayConfig the system configuration will change and the provided array sizes will no longer be sufficient to store the new path data. In this situation, QueryDisplayConfig fails with ERROR_INSUFFICIENT_BUFFER, and the caller should call GetDisplayConfigBufferSizes again to get the new array sizes. The caller should then allocate the correct amount of memory.
QueryDisplayConfig returns paths in the path array that the pPathInfoArray parameter specifies and the source and target modes in the mode array that the pModeInfoArray parameter specifies. QueryDisplayConfig always returns paths in path priority order. If QDC_ALL_PATHS is set in the Flags parameter, QueryDisplayConfig returns all the inactive paths after the active paths.
Full path, source mode, and target mode information is available for all active paths. The ModeInfoIdx members in the DISPLAYCONFIG_PATH_SOURCE_INFO and DISPLAYCONFIG_PATH_TARGET_INFO structures for the source and target are set up for these active paths. For inactive paths, returned source and target mode information is not available; therefore, the target information in the path structure is set to default values, and the source and target mode indexes are marked as invalid. For database queries, if the current connect monitors have an entry, QueryDisplayConfig returns full path, source mode, and target mode information (same as for active paths). However, if the database does not have a entry, QueryDisplayConfig returns just the path information with the default target details (same as for inactive paths).
For an example of how source and target mode information relates to path information, see Relationship of Mode Information to Path Information.
The caller can use DisplayConfigGetDeviceInfo to obtain additional information about the source or target device, for example, the monitor names and monitor preferred mode and source device name.
If a target is currently being force projected, the statusFlags member of the DISPLAYCONFIG_PATH_TARGET_INFO structure has one of the DISPLAYCONFIG_TARGET_FORCED_XXX flags set.
If the QDC_DATABASE_CURRENT flag is set in the Flags parameter, QueryDisplayConfig returns the topology identifier of the active database topology in the variable that the pCurrentTopologyId parameter points to. If the QDC_ALL_PATHS or QDC_ONLY_ACTIVE_PATHS flag is set in the Flags parameter, the pCurrentTopologyId parameter must be set to NULL; otherwise, QueryDisplayConfig returns ERROR_INVALID_PARAMETER.
If a caller calls QueryDisplayConfig with the QDC_DATABASE_CURRENT flag set in the Flags parameter, QueryDisplayConfig initializes the DISPLAYCONFIG_2DREGION structure that is specified in the totalSize member of the DISPLAYCONFIG_VIDEO_SIGNAL_INFO structure to zeros and does not complete DISPLAYCONFIG_2DREGION.
The DEVMODE structure that is returned by the EnumDisplaySettings Win32 function (described in the Windows SDK documentation) contains information that relates to both the source and target modes. However, the CCD APIs explicitly separate the source and target mode components.
|Minimum supported client||Available in Windows 7 and later versions of the Windows operating systems.|
|Header||winuser.h (include Windows.h)|
|Library||User32.lib; OneCoreUAP.lib on Windows 10|
|API set||ext-ms-win-ntuser-sysparams-ext-l1-1-1 (introduced in Windows 10, version 10.0.14393)|