If you’re using a Windows 10 laptop at anything other than the default scaling factor for your display, you may encounter an issue where closing the lid causes your window positions and sizes to be forgotten. I discovered this on my MacBook Pro Retina, which I run at 100% scaling (the default is 200%). This may also apply on Windows 8.1, but I haven’t tried it on this hardware.
In Windows 8.1, Microsoft introduced a new model of handling DPI scaling, that allowed different monitors to have different scaling factors. This is useful for situations where you’re running multiple displays of vastly different density, as it’ll make applications appear roughly the same size on all monitors.
However, at least in Windows 10, there’s a problem with this. Windows detects displays when they’re attached, and determines a proper default DPI and applies it. Once that is done, it applies your preferred scaling factor to the display. The problem with this is that closing the lid on a laptop effectively detaches the display, and opening it back up causes redetection. There’ll be no problem if you’re happy with the default scaling factor, but if you’re running a non-default scaling factor, this can cause huge problems. Apps can get stuck in the old scaling factor, windows will be rearranged, and windows will be resized. A workaround for this problem (if you don’t need different DPI for each monitor) is to disable Windows 8.1 DPI scaling, which on 8.1 could have been done by checking the “Let me choose one scaling level for all my displays” checkbox. That checkbox, however, is no longer available in Windows 10, but the registry key that it changed is still available, at
HKCU\Control Panel\Desktop\Win8DpiScaling. Change it from 0 to 1, reboot, and now all displays should have the same DPI, and closing your lid won’t change your window layout.
Obviously, there’s an underlying bug in display detection that Microsoft needs to fix (as the feature that I’ve disabled actually is a useful one). However, for my case, where I’m happy with all displays running at the same scaling factor, the old way of multi-monitor scaling (as used in Windows 98 (the first version with official multi-monitor support) through 8.0) works perfectly fine.