How Windows 11 CCD SetDisplayConfig Handles Multi-Monitor Coordinates
Iwan Efendi2 min
Technical developer guide to Win32 CCD SetDisplayConfig coordinate rules, primary display (0,0) constraints, and contiguous topology math on Windows 11.
When developing multi-monitor window management utilities or display switchers for Windows 10 and 11, the native Connecting and Configuring Displays (CCD) API—specifically
In the Windows desktop coordinate space, the top-left corner of the primary display is the origin:
If you designate a new monitor as primary, you cannot simply set its
Windows CCD rejects arrangements where any active screen does not physically touch at least one other active screen along an edge:
To prevent this error, the desktop topology normalizer must project every screen against placed screens and clamp coordinates:
When a user switches to PC Screen Only or a secondary monitor enters deep sleep, Windows disables that display's CCD path. Attempting to call
QueryDisplayConfig and SetDisplayConfig—is the modern Win32 replacement for legacy ChangeDisplaySettingsEx.
However, calling SetDisplayConfig with custom monitor coordinates frequently results in ERROR_BAD_CONFIGURATION (error code 1610 / 0x64A) or ERROR_INVALID_PARAMETER (error code 87).
Here is a concise breakdown of the three strict geometric rules Windows CCD enforces on desktop topologies.
1. Rule 1: The Primary Display Must Always Anchor at (0, 0)
// POINTL coordinates for the primary screen path
pathModeInfo.modeInfo.sourceMode.position.x = 0;
pathModeInfo.modeInfo.sourceMode.position.y = 0;SDC_SET_PRIMARY flag without shifting all other display coordinates. Every other active screen's position must be offset by (-newPrimary.X, -newPrimary.Y).
For example, if Display 2 is positioned at (1920, 0) and you make Display 2 primary:
- Display 2: moves to
(0, 0) - Display 1: shifts to
(-1920, 0)
2. Rule 2: Active Screens Must Be Contiguous (No Floating Gaps)
[ Display 1 (0,0) ] <--- 50px gap ---> [ Display 2 (1970, 0) ]
=> SetDisplayConfig fails with ERROR_BAD_CONFIGURATION (1610)public static bool Overlaps(Rect a, Rect b) =>
a.Left < b.Right && a.Right > b.Left && a.Top < b.Bottom && a.Bottom > b.Top;
public static bool IsContiguous(Rect candidate, Rect anchor, int minOverlapPx = 60)
{
if (Overlaps(candidate, anchor)) return false;
bool touchesHorizontally = (candidate.Right == anchor.Left || candidate.Left == anchor.Right)
&& (Math.Min(candidate.Bottom, anchor.Bottom) - Math.Max(candidate.Top, anchor.Top) >= minOverlapPx);
bool touchesVertically = (candidate.Bottom == anchor.Top || candidate.Top == anchor.Bottom)
&& (Math.Min(candidate.Right, anchor.Right) - Math.Max(candidate.Left, anchor.Left) >= minOverlapPx);
return touchesHorizontally || touchesVertically;
}3. Rule 3: Smart Auto-Wake From Solo Topology
SetDisplayConfig with SDC_USE_SUPPLIED_DISPLAY_CONFIG directly on a disabled path returns ERROR_GEN_FAILURE (error code 31).
To safely restore coordinates, you must execute a two-phase apply:
- Phase 1 (Topology Wake): Call
SetDisplayConfig(0, null, 0, null, SDC_APPLY | SDC_TOPOLOGY_EXTEND). - Phase 2 (Enumeration Delay): Poll
QueryDisplayConfiguntil the newly awakened path transitions toDISPLAYCONFIG_PATH_ACTIVE(typically 100–300 ms). - Phase 3 (Coordinate Restore): Call
SetDisplayConfigwith your saved coordinates andSDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_SAVE_TO_DATABASE | SDC_ALLOW_CHANGES.
Related Notes & Multi-Monitor Guides
- Windows 11 Dual-Monitor Layout Quick Reference & Hotkeys Guide — hotkey bindings, CLI scripts, and tray shortcuts.
- DisplayFlip Cumulative Release Notes & Architecture History — .NET 10 LTS and WPF-UI 4.3 release overview.
- How to Connect Your Laptop to an External Monitor on Windows 11 & Ubuntu — physical cable standards and Alt Mode troubleshooting.
Topics
Topics in this note
Explore related ideas through the topics connected to this note.
Share this article
Discussion
Preparing the comments area...