Hello The monitor numbers shown in the Windows Display Settings and those obtained through EnumDisplayMonitors or EnumDisplayDevices may not always match. This is because Windows assigns display numbers based on the order in which they were detected or added, and this order may not correspond to the physical arrangement of your monitors. Unfortunately, there’s no built-in function in Windows that directly maps the display numbers from the Display Settings to the identifiers obtained from EnumDisplayMonitors or EnumDisplayDevices. However, you can identify the displays and their corresponding numbers through the Display Settings: Press Win + I to access Settings. Select the System tab, then click on Display. Click on Identify to display a number on each screen. This number identifies which screen is primary and which is secondary. Please note that these numbers are used by Windows and its applications to identify displays and may not correspond to the “\DISPLAYn” identifiers. If you need to change the order of the displays as recognized by Windows, you might need to modify the registry. However, this should be done with caution as incorrect changes to the registry can cause serious system issues. Always back up your registry before making changes. [Windows 10 - Change Display Numbers / Identity - Super User](https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsuperuser.com%2Fquestions%2F1455322%2Fwindows-10-change-display-numbers-identity&data=05%7C02%7Cwesleyl%40wicresoft.com%7Cbff3f795d20b4ee5a73d08dc343de32c%7Cb2ae8dd9097749768706861b488b1512%7C0%7C0%7C638442687633006243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=dA6cdWvMGM%2BrXjOaDaLKm9SlgNyQvvg41MysgViy2N4%3D&reserved=0"原始 URL: https://superuser.com/questions/1455322/windows-10-change-display-numbers-identity。如果你信任此链接, 请单击或点击。") If you’re developing an application and need to map the display numbers to the “\DISPLAYn” identifiers, you might need to implement a custom solution. One approach could be to allow users to manually map the display numbers to the “\DISPLAYn” identifiers within your application.
How to get the Monitor number displayed in the system display settings
I have three monitors and use EnumDisplayMonitors/EnumDisplayDevices to get the monitor info, they can result something like "\DISPLAY1","\DISPLAY2","\DISPLAY3", but they do not match the number show in windows display setting. Is there any other way to obtain this information? Thanks!
Windows for business | Windows Client for IT Pros | User experience | Other
Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
-
Alx24 • 0 Reputation points
2025-11-11T11:38:44.55+00:00 Modern standard video adapters are physically connected to the PCIe bus, and this is visible in the Windows Device Manager under "Devices by Connection," along with the monitors connected to them. Enumerating devices on the PCIe bus also provides information about video adapters, and video adapter drivers provide information about displays connected to them, including their EDIDs.
Drivers for video adapters, usually created by their manufacturers, collect information about displays connected to them, which are considered child devices, and pass it on to Windows, which determines the initial resolution, scale, and multiple display configuration, which can be changed in Control Panel.
Therefore, the EnumDisplayDevices() function is executed in two stages: first for video adapters, then for the displays connected to them. It's worth noting that EnumDisplayDevices() provides the closest information about display numbers to Control Panel compared to all other methods.
The numbers of displays connected to the video adapters are presumably generated based on a priority table
D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY enumeration (d3dkmdt.h)
A D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY enumeration value indicates the type of connector a video output device (on the display adapter) uses to connect to an external display device.
Syntax
typedef enum _D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY { D3DKMDT_VOT_UNINITIALIZED = -2, D3DKMDT_VOT_OTHER = -1, D3DKMDT_VOT_HD15 = 0, D3DKMDT_VOT_SVIDEO = 1, D3DKMDT_VOT_COMPOSITE_VIDEO = 2, D3DKMDT_VOT_COMPONENT_VIDEO = 3, D3DKMDT_VOT_DVI = 4, D3DKMDT_VOT_HDMI = 5, D3DKMDT_VOT_LVDS = 6, D3DKMDT_VOT_D_JPN = 8, D3DKMDT_VOT_SDI = 9, D3DKMDT_VOT_DISPLAYPORT_EXTERNAL = 10, D3DKMDT_VOT_DISPLAYPORT_EMBEDDED = 11, D3DKMDT_VOT_UDI_EXTERNAL = 12, D3DKMDT_VOT_UDI_EMBEDDED = 13, D3DKMDT_VOT_SDTVDONGLE = 14, D3DKMDT_VOT_MIRACAST = 15, D3DKMDT_VOT_INDIRECT_WIRED = 16, D3DKMDT_VOT_INTERNAL = 0x80000000, D3DKMDT_VOT_SVIDEO_4PIN = D3DKMDT_VOT_SVIDEO, D3DKMDT_VOT_SVIDEO_7PIN = D3DKMDT_VOT_SVIDEO, D3DKMDT_VOT_RF = D3DKMDT_VOT_COMPOSITE_VIDEO, D3DKMDT_VOT_RCA_3COMPONENT = D3DKMDT_VOT_COMPOSITE_VIDEO, D3DKMDT_VOT_BNC = D3DKMDT_VOT_COMPOSITE_VIDEO } D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY;You can predict the numbers of connected displays in Control Panel. This is usually confirmed by the order HD15, DVI, HDMI, and Display Port. However, there are intermediate adapters that can cause different programs to respond differently when assigning display numbers, such as Intel IGCC.
The user can obtain this information using
https://learn.microsoft.com/en-us/windows/win32/wmicoreprov/wmimonitorconnectionparams
WmiMonitorConnectionParams class
from MSMonitorClass
The Windows Display Manager coordinates graphical output across multiple monitors and uses a small registry database to persist the configuration across system reboots. Control Panel uses internal calls to retrieve information about the display configuration it is displaying.
Function EnumDisplayMonitors()
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaymonitors
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-monitorenumproc
The MonitorEnumProc function always receives a handle to the display monitor.
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmonitorinfoa
GetMonitorInfoA function (winuser.h)
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmonitorinfow
GetMonitorInfoW function (winuser.h)
https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-monitorinfoexa
MONITORINFOEXA structure (winuser.h)
https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-monitorinfoexw
MONITORINFOEXW structure (winuser.h)
typedef struct tagMONITORINFOEXW : tagMONITORINFO {
WCHAR szDevice[CCHDEVICENAME];
} MONITORINFOEXW, *LPMONITORINFOEXW;
szDevice may be "\.\DISPLAY1" ...
Here you can also determine which monitor is the primary ( MONITORINFOF_PRIMARY This is the primary display monitor ) and the monitor's rcMonitor coordinates, resulting in a display similar to that in Control Panel. However, there are some details regarding Clone mode.
Using the name "\.\DISPLAYN" you can associate this data with the EnumDisplayDevices() data and also get the Device Context for visual identification of displays as in Control Panel.
GetPhysicalMonitorsFromHMONITOR function (physicalmonitorenumerationapi.h)
MSMonitorClass provides detailed physical information about displays
WmiMonitorID
https://learn.microsoft.com/en-us/windows/win32/wmicoreprov/wmimonitorid
WmiGetMonitorRawEEdidV1Block allows you to get the EDID of the monitor and from it its manufacturer and model
https://learn.microsoft.com/en-us/windows/win32/wmicoreprov/wmimonitorraweedidv1block
...
You can get the Device Context for the display
hdc = CreateDC("DISPLAY", "", "", NULL); hdc = CreateDC("DISPLAY", NULL, NULL, NULL); hdc = CreateDC("\\\\.\\DISPLAY1", "", "", NULL); hdc = CreateDC("\\\\.\\DISPLAY1", NULL, NULL, NULL); hdc = CreateIC("\\\\.\\DISPLAY1", "", "", NULL); hdc = CreateIC("\\\\.\\DISPLAY1", NULL, NULL, NULL);to then get the display characteristics or drawing (for display identification as in Control Panel).
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-windowfromdc
WindowFromDC function (winuser.h)
GetSystemMetrics() from winuser.h with SM_CMONITORS is very suitable for using DisplayN.
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getdevicecaps
GetDeviceCaps function (wingdi.h)
"Note Display1 is typically the primary monitor, but not always."
Cloned (duplicated) displays have single DisplayN and HMONITOR. Cloned displays in EnumDisplayDevices() have the names "\.\DISPLAY1\Monitor0", "\.\DISPLAY1\Monitor1", which emphasizes the difference in the numbering of physical displays and DisplayN. GetSystemMetrics() from winuser.h with SM_CMONITORS provides data in the same sense, taking cloning into account. Display Manager and Control Panel respond accordingly to monitor cloning.
-
Alx24 • 0 Reputation points
2025-11-11T11:52:13.8666667+00:00 Information about displays and their general listing can be obtained using various modules and functions, but their numbers do not match the Control Panel numbers.
Control Panel
Device Manager
DxDiag
EnumDisplayMonitors()
EnumDisplayDevices()
QueryDisplayConfig()
DisplayConfigGetDeviceInfo() (display names from EDID)
SetupDiGetClassDevs()
Config Manager functions
WmiMonitorID, wmimonitorraweedidv1block ... - MSMonitorClass
Registry
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY...
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e968-e325-11ce-bfc1-08002be10318}
QueryDosDevice
WinObj
DirectX
https://learn.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-enum
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory-enumadapters
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiadapter
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-enumoutputs
HRESULT EnumOutputs([in] UINT Output, [in, out, annotation("Out")] IDXGIOutput **ppOutput );
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgioutput
https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgioutput-getdesc
The laptop or tablet screen is logically the main one and it has not yet been noticed that its number in Control Panel is different from 1 (it is D3DKMDT_VOT_INTERNAL = 0x80000000 in WmiMonitorConnectionParams, DisplayPort in Intel IGCC).
-
Alx24 • 0 Reputation points
2025-11-14T11:14:20.04+00:00 If you reverse the connection of a pair of displays to the graphics adapter outputs, their numbers and primary display will change accordingly in Control Panel, indicating that the numbers are assigned sequentially through the video outputs (Wesley Li) (Display Port, HD15, HDMI or DP, DVI, HDMI). This means that this order is very stable, and you can even draw display numbers on the computer near the ports. fact that display numbering is handled completely differently within Windows and user APIs is evidenced by the fact that when hot-plugging a display in Control Panel, the entire numbering is completely revised in accordance with the stated principles, while in user functions, another display is simply added, which is also quite logical. Display detection is performed by the video adapter driver and depends on its developer. Microsoft Corp. has its own driver, the "Microsoft Basic Display Adapter." It also relies on the video adapter's video BIOS, but questions about it can be addressed.
Using
https://learn.microsoft.com/en-us/windows/win32/wmicoreprov/wmimonitorconnectionparams
WmiMonitorConnectionParams class
You can get information about the port type and get closer to display numbers in Control Panel.
In modern Apple macOS, switching displays in this way leads to nothing and is always the same order; display names from the EDID are used instead of numbers, there is no identification, and all displays, regardless of resolution, are designated with the same dimensions. Multiple Monitors functions are quite comprehensive in the Control Panel and API, but moving the Mouse cursor between multiple displays is a challenge. Using the Multimonitor API, a user can write a very simple program that, after switching to a display with Alt + Tab and entering the display number on the keyboard, moves the Mouse cursor to the center of the display with that number or to the last remembered cursor position on it.
-
Alx24 • 0 Reputation points
2025-11-16T12:02:06.5+00:00 If you place this code in a VBS file and double-click it, an HTML file will be generated containing the names (Name = Property.Name) and parameter values (s = objInstance.properties_(Name)) of the WMI classes from "root\WMI", "root\cimv2". You can substitute any valid class name from the cimwin32.mof file in the C:\Windows\System32\wbem directory for "WmiMonitorConnectionParams". This file has kernel-level access. You can also generate an output file in Microsoft Excel or Microsoft Word exchange format, XML or CSV.
https://learn.microsoft.com/en-us/windows/win32/wmicoreprov/wmimonitorconnectionparams
WmiMonitorConnectionParams class
Dim objService set wmiLocator = CreateObject ("WbemScripting.SWbemLocator") set ObjService = wmiLocator.ConnectServer (".", "root\WMI") ObjService.Security_.ImpersonationLevel = 3 Dim objClass Set objClass = objService.Get ("WmiMonitorConnectionParams") Set objEnumerator = objService.ExecQuery("Select * from WmiMonitorConnectionParams") Dim fso, tf Set fso = CreateObject("Scripting.FileSystemObject") Set tf = fso.CreateTextFile("WmiMonitorConnectionParams.Htm", True) tf.WriteLine("<html>") tf.WriteLine("<head>") tf.WriteLine("<meta http-equiv=Content-Type content=""text/html; charset=windows-1251"">") tf.WriteLine("</head>") tf.WriteLine("<body>") tf.WriteLine("<TABLE>") For Each objInstance in objEnumerator If Err.Number Then Err.Clear Else If objInstance is nothing Then Break Else ON ERROR RESUME Next For each Property in objClass.Properties_ If Err.Number Then Err.Clear Else tf.WriteLine("<TR VALIGN=""top"">") Name = Property.Name tf.Write("<TD width=50%>") tf.Write(Name) tf.WriteLine("</TD>") s = objInstance.properties_(Name) dim i, str if vartype(s) < 8192 then ' Array type strMessage = Space(6) & s else for i=lbound(s) to ubound(s) str = str & Chr(s(i)) next strMessage = Space(6) & str str = "" end if tf.Write("<TD width=50%>") tf.Write(strMessage) tf.WriteLine("</TD>") tf.WriteLine("</TR>") End If Next End If End If tf.WriteLine("<TR VALIGN=""top"">") tf.Write("<TD width=50%>-</TD>") tf.Write("<TD width=50%>-</TD>") tf.WriteLine("</TR>") tf.WriteLine("<TR></TR>") Next tf.WriteLine("</TABLE><BR>") tf.WriteLine("</body>") tf.WriteLine("</html>") tf.CloseFor the same displays connected to NVIDIA, AMD and INTEL video adapters, this VBScript produces different display sequences depending on the video adapter driver. For the user's benefit, the display numbers in Control Panel used for identification may vary.
Dispays and TVs have in EDID EISA ID of manufacturer for example ACR, SAM, VSM, ... and Product Code: for example 74AF (SAM74AF)
They are the starting point for display names in Windows, and then a few more characters and numbers are added (DISPLAY\VSC5138\5&10c81070&0&UID1797_0), along with the EDID in the registry.
OS Windows in Device Manager in Monitors in the Monitor Properties, Details, Hardware Ids displays the sum of Manufacturer: SAM and the number Model or in other words EISA ID: SAM and the number Product Code in the form of SAM.... and a lot of other information.
Thus, in the output .htm file, the InstanceName parameter identifies the display, and VideoOutputTechnology reports the port type as a number, according to
D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY enumeration (d3dkmdt.h)
because the display numbers in Control Panel depend on the display connection type.
InstanceName can be bound to EnumDisplayDevices()/EnumDisplayMonitors() data.
It's worth noting that enumeration of child devices as displays for a video adapter is a very typical procedure for Windows. It is also logical that new displays are added on the right. Formally, DisplayPort is the simplest interface in terms of computer video hardware and has the number 1 in CP.
For a specific display configuration, display numbers in Control Panel, where Display Manager results are displayed, are quite convenient. However, they don't remain constant when changing configurations due to their origin when listing displays by connection. Control Panel also takes into account display cloning, which means that DisplayN displays share the same number, so the two numbering systems are fundamentally inconsistent.
In this case, video adapters that are located inside the computer or even inside the processor chip are almost completely excluded from consideration for the sake of simplicity.
-
Alx24 • 0 Reputation points
2025-11-17T17:21:14.2466667+00:00 The people who created the impressive and extremely durable algorithms for multiple displays, and in particular in Control Panel, deserve very high praise. In NVIDIA Control Panel, a list of detected displays is first displayed, and then you can see how it is prepared into a user-friendly form and convenient display numbers are assigned.
Assigning DP if it is in CP a nice number 1 is also a good step. In the image provided by the questioner, the display on the far right with number one was added last but was given the number 1 and is very likely a DP.
As a result of disconnecting and connecting displays, it may turn out that DISPLAY1 disappears and the initial one may be, for example, DISPLAY2 and then DISPLAY3. During initial detection, displays are added on the right, and this probably gives an indication of the order in which display information is entered into Display Manager. Display frames are becoming increasingly narrow and it is no longer possible to place information on them, for example, about the manufacturer, so the numerical identification that was once introduced was very successful. If you move the Mouse cursor to the icon on the Taskbar, a miniature image of the window with the system menu icon will appear. By pressing it with the right button, you can call up the system menu and perform some operations without moving the cursor to another display, for example, moving a window. The Control Panel provides information about the layout of monitor screens in a multi-monitor configuration, including for orientation when moving the Mouse cursor. To avoid the time-consuming process of moving the cursor between multiple screens, the program can immediately move the cursor to the window being activated when processing the WM_ACTIVATE message, for example, after switching tasks using Alt + Tab. The order of displays in EnumDisplayMonitors, EnumDisplayDevices is more similar not to the numbers of displays in Control Panel, but to the order of displays in Control Panel from left to right as they are added to the right. HMONITOR also accepts the sequential values 0x10001, 0x10003, 0x10005. When hot-plugging, HMONITOR isn't quite as simple and elegant. Based on some experimentation, it can be assumed that the display sequence generated by WmiMonitorConnectionParams in the above VBScript will correspond to the attractive numbers in Control Panel if the entry with the highest VideoOutputTechnology (D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY) is moved to the first position, if it isn't already there. For DP, this is done automatically. This means that the most technologically advanced displays are moved to the first position. Further, it seems that VideoOutputTechnology mainly decreases. Some sort of ordering of data from drivers about displays for the user in Control Panel is quite advisable. WmiMonitorConnectionParams also provides processed results that can be compared with the results of EnumDisplayMonitors, EnumDisplayDevices. The NVIDIA Control Panel provides complete display input sequence and output numbering for identification. In Windows Control Panel, displays detected by the driver are initially arranged from left to right. NVIDIA, AMD, and INTEL driver packages provide various functions for programmatically obtaining information about displays connected to their video adapters.