161

I'm using latest Windows 10. I have dual monitors and am working on software development. I move Visual Studio to second monitor to work on it.

When I lock wndows and leave computer and go somewhere and come back after 20-30 min both laptop and second external monitor is black and I need to enter my password. When I unlock the computer Visual Studio 2017 moves to the primary (laptop) diplay.

Everytime I have to move Visual Studio again to second monitor. Is there a way to solve this problem?

3
  • 2
    My new monitor is bit slow to wake up from sleep and does exactly what you describe. Previous monitor was DVI-D -connected, new one is DisplayPort. If only I could instruct Windows to wait a bit longer. Commented Nov 16, 2020 at 18:58
  • 1
    Since I can't add an answer, I will write this comment. Make sure to have the same Response Time set to Normal on both monitors, change the Display Port version to 1.2 (if you have one and if possible) and go to Device Manager and click Update Driver on both monitors and let Windows find the driver for you on the internet. Also disconnect any other cables and let only the 2 cables you use. This solved my issue. Might help others, since it was so annoying.
    – Dan
    Commented May 27, 2021 at 13:37
  • I have this problem since I switched from an old monitor to a new one. Not sure what is the root cause, but the old monitor was connected through VGA and new one through HDMI.
    – Kar.ma
    Commented Nov 10, 2023 at 13:21

9 Answers 9

89

A similar case on Microsoft Community mentioned a workaround, have a try.

  1. Start Control Panel --> Device Manager
  2. Select View --> Show hidden devices
  3. Expand Computer --> Monitors*

When you expand the Monitors you will see your current monitor (highlighted) and all the disconnected monitors (greyed out). You may see monitors with "non-PNP" and "PNP" listed as well. I believe these are aliases to your current monitor (at a lower resolution) before Windows installed drivers for it.

I uninstalled ALL the greyed out monitors. Right-click on these monitors and select uninstall. Keep only the highlighted monitor you are currently using.

  1. Uninstall all greyed out monitors (even non-PNP and PNP monitors)
  2. Reboot your system.

After doing this my windows don't resize after my monitor goes to sleep. You can quickly test this by temporarily setting your monitor sleep time to 1 minute.
Settings --> System --> Power & Sleep --> Screen [1 minute]

Source: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-10-multiple-display-windows-are-moved-and/2b9d5a18-45cc-4c50-b16e-fd95dbf27ff3

11
  • 60
    This workaround has no effect whatsoever on my system.
    – queezz
    Commented Mar 22, 2019 at 6:43
  • 1
    This worked perfectly for me. After upgrading graphics card the chrome window was on the main monitor after each wake-up from sleep. Now after uninstalling all grayed-out monitors its fine like it was before. Thanks
    – KYL3R
    Commented Jun 1, 2019 at 7:38
  • The flickering of the screens went away completly, so definitely a big improvement! The windows still move all to the same monitor though.
    – Tigerware
    Commented Jul 10, 2019 at 12:12
  • 1
    In the end: I also had to do this superuser.com/a/1187076/19496 i.e. never turn off monitors.
    – user19496
    Commented Jan 4, 2020 at 8:14
  • 6
    As of 23July2022, this method does NOT fix the stated problem. When the monitors go into power save mode then come back on, ALL windows are transferred to the primary monitor. This is an absolutely ridiculous problem to have and none of the fixes seem to work. I'm about to just write an AHK script to handle this problem. How Windows continually makes each iteration of their OS worse is beyond me... Commented Jul 24, 2022 at 13:05
19

I ran into a similar issue and the answers that were provided here did not resolve the issue. After a few searches, I found a GitHub app that did resolve it. Take a look at PersistentWindows. So far it has worked well for me.

(Note: I have no affiliation to PersistentWindows.)

3
13

The currently accepted answer by Origami does not work for me.

But this workaround helps, although far from a complete solution.

Prerequisites:

  • system must be locked before going to sleep (lock it by the key combination WINDOWS-L and let it then go to sleep or make sure it locks by itself before sleeping - maybe with screensaver settings, I always lock manually, so did not test this; just letting the PC go to sleep (unlocked) will not work, even if it asks for the password when waking up)

Workaround:

  • when the monitors are sleeping, move the mouse
  • wait until the monitors turn on
  • the monitors might blink once or twice, just give them good 5 or 10 seconds, so they are 100% on and detected by Windows
  • press a key, mouse button or ctrl-alt-delete, depending on Windows configuration, so that the login screen appears, asking for password
  • enter password and unlock the PC

Result:

  • windows are where they were left

Sometimes only some windows stay at their position and some get moved to the main display even if you do the described workaround. I guess there is nothing more to do than wait for Microsoft to fix this.

3
  • Thank you for mentioning this. I have one of the answers on this page, but I'm not sure how to apply that answer to my new work laptop. If I just wait a few seconds for the monitors to activate before logging in, the windows stay where they are after logging back in.
    – Bob Horn
    Commented Jan 15, 2023 at 23:58
  • This didn't work for me on the latest Windows 10.
    – hypehuman
    Commented Apr 19, 2023 at 20:31
  • 1
    This seems to work well but just on my primary desktop. Second/third/fourth desktops seem to have varying levels of success at holding their window positions. Commented Aug 11, 2023 at 20:07
12

It was stated that:

"The technical term for the problem is "Rapid Hot Plug Detect," but with the latest Windows Insider build 21287 or above, Microsoft has worked to mitigate the issue. With this release, when you wake up from a sleep, all your windows should appear where you previously left them.

You'll need to join Microsoft's Insider program to get the new feature, which will work by default if you're connected to at least one external monitor with a laptop, or two monitors on a desktop setup. It should also work across brands, hardware specs and connector types. If you're not willing to join the beta program to test it right now, Microsoft is expected to ship the final version by October, 2021."

(reference to original article)

It works for me after waking up from sleep! However, it does not work after waking up from hibernate. Hopefully, Microsoft is planning fixing this as well for the upcoming update.

2
  • So this is the fix that they talked about in the Windows 11 presentation, that is supposed to keep windows on the same display. I hope this will work.
    – Henk Poley
    Commented Sep 29, 2021 at 7:09
  • i'm on win11 latest as of 9/18/23 and the issue is still not resolved Commented Sep 18, 2023 at 20:37
10

TL;DR - if the windows are moving to a VGA connected monitor, it looks like there are three options, in order of "fixed" to "workaround":

  • Change the connection to that monitor to something other that VGA (changing to DisplayPort connection fixed it for me)
  • Make the VGA monitor the Primary Monitor.
  • Unplug the VGA monitor, then plug it back on each resume.

I had this problem - all the windows shifted to one monitor on resume from sleep / hibernate. The LCD monitor the windows shifted to was connected by VGA cable - my primary monitor is connected by DisplayPort, plus the laptop display.

Turning off the VGA monitor didn't force the windows to shift back to the primary monitor, but unplugging the VGA monitor did force the windows back.

I guess that the VGA connection does not report that the monitor is actually off, just that there is a monitor present, and Windows detects it before the DisplayPort connected monitor or even the internal laptop display, so moves the Windows to the VGA monitor.

Fortunately, the VGA connected monitor also has DisplayPort connection, so I changed the monitor to DisplayPort, and the problem was resolved.

8
  • I can´t believe it was so simple to solve this. Had an HDMI cable forgotten into a drawer for almost 1 year of dragging 3+ screens back to the second monitor after unlocking the screen. Thnak you very much, sir.
    – Mudo
    Commented Jan 22, 2019 at 16:18
  • 12
    Now having this problem with to identical monitors connected to two DisplayPorts.
    – queezz
    Commented Mar 22, 2019 at 6:46
  • 1
    I too am now suddenly having this issue after switching from 2 old hdmi to new 2 displayport monitors! Commented May 4, 2019 at 0:02
  • For me the monitor that is connected through DVI is the dominant one, compared to two others, which use DisplayPort.
    – Tigerware
    Commented Jul 10, 2019 at 12:14
  • I have on each on VGA and HDMI. Making VGA primary did work initially for me but, the issue suddenly came back for no apparent reason after about 2 weeks - doomed! Going back to Win7 :D
    – zumek
    Commented Apr 14, 2020 at 10:35
4

This worked for me: https://sites.google.com/site/ebobster/stuff/displayportblanking

Bottom line: Go into your NVIDIA control panel (or whatever software you have) and change the EDID source from "monitor" to "file." You do this by exporting the settings for each file, then import them again. Now your monitor doesn't determine the setup, the file does.

In this screenshot, where you see "File", it used to say "Monitor."

enter image description here

4
  • Windows 10 GeForce RTX 2080 I don't have View System Topology, I think this is only on older cards. I found this nvidia.com/en-us/geforce/forums/discover/239683/… Commented May 6, 2020 at 3:44
  • GTX 960 running nVidia CP 8.1.959.0. There is no Workstation option in the tree. I checked all available options. Nothing for EDID Source.
    – OXiGEN
    Commented Jan 5, 2021 at 23:33
  • 7
    This only applies to Nvidia professional workstation graphics cards. The Workstation section is not available when using consumer gaming cards.
    – anders-hou
    Commented Jan 6, 2021 at 21:36
  • 1
    This works fine for me on my laptop w/ external displays. The only clarification to make is to hit "Export EDID" for each file then go to the middle tab (Load) and load the file and check the box for the monitor it applies to. I named my exports "monitor1.txt" and "monitor2.txt" for easier tracking. Thanks for the solution!
    – Nick
    Commented Aug 9, 2021 at 17:42
1

Update: It only worked a couple of times after restart. After screen turns off due to powersaving on lockscreen, and unlock, seemed like it didn't work due to switching monitors displaying the main lockscreen (so presuming it also switched the screen setups).

Edit the Windows Registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TMM\UseIViewHelper to 0. Also despite the source saying it only works on mobile computers, it worked on desktop for me. This worked for me, source: https://endurtech.com/second-monitor-on-windows-10-resets-after-sleep/

For this fix, we’ll need to update the Windows Registry (be sure to backup first). Click on “Start” then type “regedit” and press the enter key on your keyboard. Within the Registry, copy and paste the follow path into the address bar at the top of the Registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\

We should now be on the “Microsoft” folder. Expand this folder and look for a sub-folder named “TMM“.

If the TMM folder exists, double click on it and look for an entry labeled “UseIViewHelper“. Set value to 0. If UseIViewHelper does not exist, right click on the TMM folder and create a new DWORD (32-bit Value) with the name “UseIViewHelper“. Set the Value data to 0 with a Hexadecimal base. If the TMM folder does not exist under the Microsoft folder we need to create it. To create this folder/key go to the parent “Microsoft” folder and right click on it. From the context menu select “New” then “Key” and insert “TMM” without the quotes. Right click on the newly created TMM sub-folder and create a new DWORD (32-bit Value) with the name “UseIViewHelper“. Set its value to 0 with a Hexadecimal base.

1
  • Didn't work for me Commented Aug 28, 2022 at 11:18
1

Just to document it. Hard to admit it but I got this "send all windows to one screen after unlock" after accidentally attaching one of the screens to the machine with two display port cables.

0

I had a similar issue, but only on wake-up after hibernate. Sometimes after connecting to second monitor in "extended desktop" configuration, I could only interact with windows on the first display (laptop). Rebooting of course was fixing the issue, but the point of hibernate is not being forced to start work from scratch every time I wake up the system.

Today I've finally found that "dwm.exe" process (Desktop Windows Manager) was duplicated for some reason. And apparently some configuration was not restored properly for my user session. After restarting the right process as Administrator, all went back to normal.

What I did was to:

  1. open command prompt as administrator (open Start, type "cmd.exe", right-click and select "Run as Administrator")
  2. run "taskmgr.exe" in this command prompt window (with elevated privileges)
  3. switch to the "Details" tab
  4. search for "dwm.exe" process(es) and use "End Task" button or from context menu
  5. necessary DWM process should restart itself for your user session, while the "wrong" processes should just end without notice

Warning: I immediately noticed that Chrome browser did not respond well to the restart of dwm.exe process; all Chrome windows were black. Firefox did not have such issue. Luckily, just trying to open a new Chrome window by pressing Ctrl+N shortcut helped with this.

1
  • Interesting thing to note here is that some time after I posted my workaround above in aforementioned thread on Microsoft Community, some update to Windows 10 fixed my issue completely. Hooray! :) I mean, the dwm.exe process is sometimes restarted automatically after connecting back the monitor, and I didn't need my own "solution" for a long time. Commented Jan 16, 2020 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .