Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

QueryDisplayConfig function

The QueryDisplayConfig function retrieves information about all possible display paths for all display devices, or views, in the current setting.

Syntax


LONG QueryDisplayConfig(
  _In_      UINT32                    Flags,
  _Inout_   UINT32                    *pNumPathArrayElements,
  _Out_     DISPLAYCONFIG_PATH_INFO   *pPathInfoArray,
  _Inout_   UINT32                    *pNumModeInfoArrayElements,
  _Out_     DISPLAYCONFIG_MODE_INFO   *pModeInfoArray,
  _Out_opt_ DISPLAYCONFIG_TOPOLOGY_ID *pCurrentTopologyId
);

Parameters

Flags [in]

The type of information to retrieve. The value for the Flags parameter must be one of the following values.

QDC_ALL_PATHS

All the possible path combinations of sources to targets.

Note  In the case of any temporary modes, the QDC_ALL_PATHS setting means the mode data returned may not be the same as that which is stored in the persistence database.
 
QDC_ONLY_ACTIVE_PATHS

Currently active paths only.

Note  In the case of any temporary modes, the QDC_ONLY_ACTIVE_PATHS setting means the mode data returned may not be the same as that which is stored in the persistence database.
 
QDC_DATABASE_CURRENT

Active path as defined in the CCD database for the currently connected displays.

pNumPathArrayElements [in, out]

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.

pPathInfoArray [out]

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.

pNumModeInfoArrayElements [in, out]

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.

pModeInfoArray [out]

Pointer to a variable that contains an array of DISPLAYCONFIG_MODE_INFO elements. This parameter cannot be NULL.

pCurrentTopologyId [out, optional]

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.

Return value

The function returns one of the following return codes.

Return codeDescription
ERROR_SUCCESS

The function succeeded.

ERROR_INVALID_PARAMETER

The combination of parameters and flags that are specified is invalid.

ERROR_NOT_SUPPORTED

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.

ERROR_ACCESS_DENIED

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.

ERROR_GEN_FAILURE

An unspecified error occurred.

ERROR_INSUFFICIENT_BUFFER

The supplied path and mode buffer are too small.

 

Remarks

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.

Requirements

Target platform

Universal

Version

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

DLL

User32.dll

See also

DISPLAYCONFIG_MODE_INFO
DISPLAYCONFIG_PATH_INFO
DISPLAYCONFIG_PATH_SOURCE_INFO
DISPLAYCONFIG_PATH_TARGET_INFO
DISPLAYCONFIG_TOPOLOGY_ID
DisplayConfigGetDeviceInfo
SetDisplayConfig

 

 

Send comments about this topic to Microsoft

Show: