Open BjAlvestad opened 4 years ago
https://stackoverflow.com/questions/27931013/odd-experience-with-screen-allscreens
it seems to be a matter on how the Screen Resolution applet and the API handle the monitors (one seems to be using the registry, while the other queries the driver), and it can happen depending on the order in which you connected your monitors.
the culprit seems to be the GetMonitorInfo function, which is called on the callback to EnumDisplayMonitors
there is a mismatch in how Windows stores its own settings to determine what is the primary desktop monitor and how the graphic card driver decides the connected device is the primary monitor.
wp_GetMonitorAt(...), which is used by these functions uses system call "SysGet" to get monitor info. This information is provided by Windows. It seems however that the order/numbering of these monitors are reported is not necesarily the same as what is shown in "Display Settings".
See also: https://autohotkey.com/board/topic/66536-sysget-incorrectly-identifies-monitors/
https://docs.microsoft.com/en-us/windows/win32/gdi/enumeration-and-display-control https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaymonitors