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

29 comments:

Unknown said...

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

Unknown 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.

Anonymous 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!

Unknown 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!

Unknown 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

Unknown 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 :|

Unknown 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!

Unknown 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!!!

Unknown 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.

Tim said...

Hooray for Fred!

Unknown said...

I deleted all the monitor entries out of Configuration key (I had about 15), but also the connectivity key below it and rebooted Windows. It correctly detected my current setup and now shows one entry in Configuration and 1 in Connectivity, the PrimSurfSize.cx and .cy also now have the correct 2560x1440 screen size as well.

Tested by letting the monitor go to sleep after a minute (by changing the timer in power plan) and all my windows stayed on their screen and retained their size, we shall see how this goes! Thanks for the help people!

ProductsRace said...

yes yes yes this is what exactly happened from when I switched to Acer H277HU 27-inch With USB-C Monitor (Review)

RickMo said...



Here's what's working for me... so far:

http://www.ninjacrab.com/persistent-windows/

"A poorly named utility that persists window positions and size when the monitor display count/resolution adjusts and restores back to its previous settings."

I employed the removal of grayed out monitors (via the Device Settings) and it worked... for a day.

I'm on Windows 10 version 1903.

MC said...

I have the Philips BDM4350UC/00 and I had this problem. I did however solve it very easily by turning on the RS232 option in the OSD menu. Maybe this function exists on other displays and hopefully it can help someone.

Unknown said...

This fixed my issue. I kept having my windows resize to extremely small windows (768px) when moving them around, or on wakeup in windows 10. Strange issue, took me ages to find this blog, but you saved me. Hopefully this helps people long into the future.

Monitors: Acer Predator 27" xb1 and Acer Predator x34p 34".

Unknown said...

This is my monitor model(ThinkVision T2224d 21.5-inch LED Backlit LCD Monitor) and my windows 10 screen is bigger than the VM window whenever I turn off the monitor VM is minimizing and going to the left corner, please can anyone help me to resolve this issue?

Only VM window is resizing remaining windows were not resizing.

Unknown said...

I tried all of the suggestions here and I still have the issue. I removed the entire "Configuration" folder in the registry (I backed it up of course) and restarted the system, which caused the driver to make a new Configuration folder with one entry with the current monitor (single monitor setup, an Acer 27" 1440p 144Hz model). I did not get rid of the problem though, everytime I turn off the monitor and turn it back on all open windows (it is not affecting the ones that are not open at the time I turn the monitor off!) are tiny and in the top left and the desktop icons get moved too.

I also tried turning off Auto Source in the monitor OSD, didn't help. I tried all variations of scaling in the NVIDIA control panel, on and off and with with GPU or display, nothing changed. What a joke.

Christopher said...

Why has this not been resolved yet, if there are two monitors of the same resolution then when both monitors are off for a period of time then turned on; the windows from one monitor should not be resizing or repositioning themselves to the other monitor.

This issue is more then seven years old, there has been numerous updates to windows; yet this issue persists. The solutions have been simply hacks, that have no proven to be effective in alot of situations.

What is required is; is this issue related to hardware by means of the cable connection whether that is DVI or HDMI and from what I've read, this doesn't seem to be the case. Instead it seems to be related to Windows with no solid solution.

Beanz said...

This blog post is very old and wont work for many people now.

On more modern versions on Windows, and when using a modern monitor/TV, instead of going to the SIMULATED folder as this blog post mentions, instead look for a folder that begins with NOEDID. Expand NOEDID and you'll see a 00 subfolder. Click on this 00 folder and you need to change PrimSurfSize.cx and PrimSurfSize.cy to the resolution you're using (so in my case with a 4K TV it would be 3840 for .cx and 2160 for .cy).

Nothing else should need changing. This fixed the problem for me on two different PC's, but i'm only using a single 4K TV with each. It may not work for multiple monitors but worth a try. If it doesn't work, try inputting a very high res that either matches or exceeds the resolution of all your monitors combined.