4 ms·
The documentation--the very links that OP provided--does say all of this. Look in the "Remarks" section of EnumDisplayDevices and ChangeDisplaySettings.
by moron4hire 4y ago
The documentation--the very links that OP provided--does say all of this. Look in the "Remarks" section of EnumDisplayDevices and ChangeDisplaySettings.
- wongarsu 4y agoI always found the msdn documentation quite good, in the sense that almost every aspect of each API is described. However you have to read it thoroughly, a quick skim often leaves you doing things subtly wrong. I think that's where most people fail. The API is often complex because of how old some parts are and how often things got extended in backwards-compatible ways
- esprehn 4y agoYup, even with a code sample that addresses this situation: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-changedisplaysettingsexa#remarks 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_only_law 4y agoI don't blame them tbh, Microsoft seems to treat documentation that's not .NET as second class. 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"
- legalcorrection 4y ago2008 would be too long ago for web stuff, but in Windows land, that’s plenty recent. Win32 APIs are forever.
- the_only_law 4y agoA single code sample, that's probably poorly commented in my experience is hardly what I'd consider good documentation. 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.
- michidk 4y agoOh. This is embarrassing! I totally disregarded the remarks section when reading through all the different system calls. This example is actually quite helpful and would have saved me from hours of research. Lesson learned, i guess.
- ogurechny 4y agoYep, doesn't seem to be an arcane knowledge: https://archive.org/details/windowsgraphicsp00juli/page/658/mode/2up https://archive.org/details/windowsgraphicsp00juli/page/658/... 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.