https://docs.microsoft.com/en-us/windows/win32/api/winuser/n...
So the whole article is sort of "I reverse engineered software for fun instead of reading the docs"
It's a fun read about the quirks of the Windows API though.
The Win32 documentation admittedly can be pretty good, when you can easily find what you're looking for. There's ben multiple times where I've gone looking for documentation for a still supported API only to be told "oh yeah the best option is to check out this old ass sample code from 2008"
OTOH it's pretty easy to get help. People I know very skilled with the Windows API seems to be documentation themselves. I have seen RE guys casually bring up undocumented behavior of certain APIs off the top of their head.
The API is often complex because of how old some parts are and how often things got extended in backwards-compatible ways
It would be more interesting to find out why the order of monitors changes “randomly” (computers can't really do anything randomly unless asked specifically). It could be something simple, like background driver updates that reset options they shouldn't reset, or the powered down state of monitors on boot, or video card enumerating connected devices differently, etc.