Wednesday, December 3, 2014

Windows changing size & position after monitor sleep

I recently updated my old 24" Dell monitor to a 32" Acer B326HUL, love it! But I found that when the monitor went to sleep, the windows got resized to a smaller res, as well as all the desktop icons got rearranged. Digging around on the internet found that Windows somehow remembered 1920x1200 as the res, and resizes all windows to fit that when coming out of sleep.

So the fix is registry magic!
In this register tree:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\

there is at least an entry per monitor; I had a DELxxxxxxxxxx and an ACRxxxxxxxxxx one, and under the 00 node, there are two parameters to check out there:
PrimSurfSize.cxPrimSurfSize.cy and Stride.

These should match your current monitor.

A little below you should see these entries:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\SIMULATED_xxxxxxxx

inside, you will also find under the 00 node, and those parameters pointing to the old sizes. Use the values from above, and also change under the remaining 00 node the ActiveSize.cx & ActiveSize.cy entries to match. Log off or restart and voila!



References:
https://social.technet.microsoft.com/Forums/en-US/4d8f3aef-8c04-481b-a69a-ec0fbf3669c2/turning-off-display-resizes-open-windows?forum=w7itproperf
http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/windows-7-movesresizes-windows-on-monitor-power/1653aafb-848b-464a-8c69-1a68fbd106aa?page=2

19 comments:

Chip Malee said...

I believe this is the video version.
https://youtu.be/bh-qFXOWoyo

Grim Bonkers said...

Did the exact thing. Problem not solved. When I turn of the monitor and turn it back on, all windows get squeezed in the upper left corner and are very small.

(windows 7, monitor conencted with DisplayPort)

Basic said...

Note that by default the values are entered in HEX not DECIMAL. Make sure you select decimal before typing any numbers.

Thaty said, I don't have a SIMULATED_ node at all. I do have a MSNILNOEDID_ which doesn't seem to relate to any valid display but changing the settings under there doesn't seem to have any noticeable effect.

ChangeTheFuture said...

Unfortunately not. There’s no SIMULATED key inside “Configuration” for me.

Windows 10.

Anonymous said...

Thanks for this as the problem has been driving me up the wall... I'm on Win 10, NEC EA275UHD 3840x2160 monitor, Nvidia Quadro K5000 with displayport... I found the SIMULATED registry entries and changed all 3 of them...

Crispian Longlife said...

I have windows 10 and was having this problem on my 3440 x 1440 (native) Asus ultra wide screen monitor (Display Port connection) and 27" DELL 2407 monitor 1920 x 1200 (native) DVI connection. Using NVIDIA GeForce GTX 980 Ti graphics card.
I have no simulated registry entries. I decided not to try to fiddle with the registry even though some entries were not set to the above resolutions. I have about 6-7 entries under the configuration directory. After reading through several comments. I saw the scaling comment.
In my NVIDIA Control panel I disable scaling for both monitors. So far this worked!
The windows remained in place once the computer woke from sleep mode. YAY!

lifesgood said...

Disabling scaling in the NVIDIA Control panel worked for me. Thank you Crispian Longlife!

I have a Samsung UHD4K 3840 x 2160 40 inch TV connected with HDMI as my primary monitor and a old 1680 x 1050 monitor on DVI as a secondary with a NVIDIA GeForce GTX 970 graphics card.

silt sunrise said...

I didn't have the simulated entries, but one of the 4 I did have, showed a lower res than my monitor uses. I changed those values and wahla, they stuck. No more shrinking windows after sleeping!

Ian Grainger said...

How do I apply this if I have multiple monitors? The numbers I see in there match my old monitor connection, but also my current laptop monitor...

Is there no way to reset this? I don't suppose deleting them will cause Windows to recreate them with correct values, for e.g.? Or even better a nice way to get Windows to forget this monitor's properties so it can re-learn them correctly!

R Caloca said...

If I got frustrated enough, maybe I would just delete the full Configuration folder :)
In theory you can backup those registry keys/tree, so it shouldn't be that bad... But that's just in one of those throw the PC against the wall moments!

Ian Grainger said...

OK - so no idea how to deal with multiple monitors? I've given up and gone for it - changed all 3 to match my larger external monitor. Will just see if it works! :-S

Ian Grainger said...

OK - so no idea how to deal with multiple monitors? I've given up and gone for it - changed all 3 to match my larger external monitor. Will just see if it works! :-S

R Caloca said...

Nope, hasn't been at issue at work (where I have dual monitors); at home I only have one :|

Fred Larsen said...

I worked for a full day to solve this. Tried all software solutions. The only things that works for me is to adjust the behavior in each monitor's on-screen menu.

For my Philips 4k monitors BDM4350UC and BDM4065UC: Must enable the factory on-screen menu by keeping the menu button pushed away from the power switch when turning the power on. Then in the on-screen menu there is a new choice "Factory". Within this hidden menu disable "EDID WP" and "AutoSource". Then turn everything off. This solved the issue for me. Every window remains where I leave it :-)

From some other forum: Some brands have "Always On" that must be turned on, or "Deep Sleep" that must be turned off, within the on-screen menu.

Hope someone find this helpful and saves a day of work :-)

R Caloca said...

Thanks Fred!

Tony Cole said...

Yes, you have saved me a lot of time (I've only spent 1/2 a day on it) - thanks!

On my Philips BDM4350UC/00 "Brilliance 4K Ultra HD LCD display" I just switched the factory menu AUTO SEARCH to NO and it has fixed it. (There is no EDID WP option).

Although, with this monitor it seems that if there is no display input then I can't get the OSD to appear (except for language selection) and so can't change input source!!!

Chris Sherwood said...

I tried everything from previous searches and everything on this blog, from registry hacks to the adapters own settings menu (looking for 'always on' or similar).

What seems to have worked for me was turning the Asus monitors' Adaptive-sync off for both monitors. Do read up on what that setting is for to be sure you won't miss it.

Microsoft should still fix this -- it is mind boggling insane that a normal computer user would have to go anywhere near this level of troubleshooting to get what is really quite normal expectations of how monitors should work with Windows and its sleep mode. I'm annoyed that I had to go to the trouble I did, all the reading, all the testing. Those SDET employees at Microsoft make a lot of money. So do the PMs that have triaged this bug to "won't fix" or "doesn't meet the bar" from one Windows version to the next.

Samuel said...

My problem: Each time the screens went to power saving and back on, everything would be moved to the main screen.

Solution and analysis:

For years I had this issue, first with a different set of screens. I reinstalled Windows (7, 10), I changed graphics cards over the years, the entire PC, etc.
I replaced one screen with a gaming one and kept the other screen.

I spent days modifying the registry keys and I would definitely not recommend doing that again. At least making a recovery point is crucial.
Registry modifications did nothing to me. I removed them all and reinstalled Graphics Adapter, reinstalled NVIDIA Drivers (as all GPUs were NVIDIA's). Installed Ubuntu to see whether this was an OS issue (it wasn't).
I disabled scaling, all to no avail.

I remember that I even had contact with some second level support, which was an actual engineer at NVIDIA trying to pin-point a possible issue in their drivers, but no luck then.

I even dived into the factory OSD of my old LG flatron but no option helped me there.
I watched window messages with Spy++ to check for screen disconnect messages etc.

I changed primary and secondary screen, I changed the virtual orientation of both in the settings to rule out some quirky situation.

One thing I realized: I could force this behaviour by simply pressing power-on on one of my screens. The old one caused to shift all the windows, the new one did not.
If I would set the old screen as the primary and power it off it would cause a shift of all windows to the new one and on power-on back again.

So basically for whatever reason, my old screen would disconnect whenever it went to energy saving mode.

To rule out faulty connection cables or ports I started to permutate the connections and cables and then I was able to find the issue:
The old screen has a VGA, DVI and HDMI port. For whatever reason my trusty LG Flatron W2442PA would never disconnect when I connect my PC via DVI but would do so when connected via HDMI. The other screen would not do such a thing. The LG's factory OSD menu had no option to adjust this behaviour so the HDMI implementation of my old LG was causing all the troubles for years. I did not check any HDMI specification on whether this is a design issue or a bug of it. But as long as I have one last DVI port on my graphics card, this will do.

Searching for that issue always resulted in registry hacks or some angry person over at Microsoft forums shouting at Microsoft to fix this bug...

Maybe this will help someone.

DominateEye said...

I also have two monitors hooked up, both HDMI, but I also have a TV connected to my PC via HDMI. I only have two HDMI ports, though, so I've had to use an HDMI to DVI adapter for one of these displays (I'm not sure which one). Both monitors are Philips, and the TV is a flatscreen Westinghouse.

I managed to access the factory service settings for the Philips monitors (and turned off the BSoD-blue so-bright-my-eyes-hurt startup screen, thanks!) and tried turning off Source Auto Search on both, but that didn't solve the problem. When I followed the instructions in the original post, I didn't see any SIMULATED entries either, and I had a hell of a lot of PHLXXXXX entries, far more than just one for each monitor. Initially, I decided not to mess with the registry because mine didn't look like the picture. But after exhausting all other options, I went ahead and looked through each entry. AFTER creating a restore point, of course.

Several of the entries had what I recognized as other resolutions in the .cx and .cy values (both in the sub-entry and the sub-sub entry-- don't forget about the arrow next to the first 00, 01, 02, etc entries you find, there are more hiding in there) and different numbers for the Stride values, what I can only assume are total pixel space in the space defined by .cx and .cy.

My monitors are 1080p, so my notes for how the values should look looked like this:
PSS.cx - 780 (1920)
PSS.cy - 438 (1080)
Stride - 1e00 (7680)
If you want to save time, when you change the values, just type the first number you see there, that's the hexadecimal value, and the window that pops up is by default set to hexadecimal so this way you won't need to change it over and over again. Obviously these values won't work for you if you have a monitor with a different resolution, but in that case just find an entry with the correct values and take note of them.

I had about four or five sub-entries that needed changing, each with one or two of their sub-sub-entries that needed changing as well. Somewhat tedious, but easy enough. After I'd changed them all, I logged out of my account, logged back in, set up my windows how I like them, hit sleep mode, woke my computer back up, logged back in and... there they were, exactly as I had left them. Finally!

I still have one problem, though. I can't turn my TV on without the Philips monitors refreshing and moving my windows around again. This happens with or without Auto Search on, unfortunately. I'm still looking for a solution, but as I don't really use my TV that regularly, it's nowhere near as much of a problem as my Philips monitors were. If anybody has any suggestions, I'd appreciate hearing them.