User32SetDisplayConfig Method

Modifies the display topology, source, and target modes by exclusively enabling the specified paths in the current session.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", ExactSpelling = true)]
public static Win32ErrorCode SetDisplayConfig(
	uint pathInfoArrayCount,
	[OptionalAttribute] DisplayConfigPathInfo[] pathInfoArray,
	uint modeInfoArrayCount,
	[OptionalAttribute] DisplayConfigModeInfo[] modeInfoArray,
	SetDisplayConfigFlags flags
)

Parameters

pathInfoArrayCount  UInt32
Number of elements in pathInfoArray parameter.
pathInfoArray  DisplayConfigPathInfo  (Optional)
Array of all display paths that are to be set.

Only the paths within this array that have the DISPLAYCONFIG_PATH_ACTIVE flag set in the Flags member are set.

This parameter can be .

The order in which active paths appear in this array determines the path priority.

modeInfoArrayCount  UInt32
Number of elements in modeInfoArray parameter.
modeInfoArray  DisplayConfigModeInfo  (Optional)
Array of display source and target mode information (DisplayConfigModeInfo) that is referenced by the ModeInfoIndex member of and ModeInfoIndex element of path information from pathInfoArray parameter.

This parameter can be .

flags  SetDisplayConfigFlags
A combination of flag values that indicates the behavior of this function.

Return Value

Win32ErrorCode
The function returns one of the following return codes.

ERROR_SUCCESS: The function succeeded.

ERROR_INVALID_PARAMETER: The combination of parameters and flags 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_BAD_CONFIGURATION: The function could not find a workable solution for the source and target modes that the caller did not specify.

Remarks

See Also