Windows on second monitor moves to primary monitor after sleep/lock

44

15

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?

Can

Posted 2018-02-06T08:00:26.150

Reputation: 443

Answers

35

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

Start Control Panel --> Device Manager Select View --> Show hidden devices 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.
Uninstall all greyed out monitors (even non-PNP and PNP monitors) 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]

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

Origami

Posted 2018-02-06T08:00:26.150

Reputation: 1 309

9This workaround has no effect whatsoever on my system. – queezz – 2019-03-22T06:43:02.313

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 – 2019-06-01T07:38:18.650

The flickering of the screens went away completly, so definitely a big improvement! The windows still move all to the same monitor though. – BluE – 2019-07-10T12:12:49.887

not working for me – HelloWindowsPhone – 2019-10-19T05:31:42.043

Confirmed as working 2020-01-02. I did "Uninstall device" to all grey icons except "Location: on Microsoft Basic Display Driver". – user19496 – 2020-01-02T10:49:25.150

In the end: I also had to do this https://superuser.com/a/1187076/19496 i.e. never turn off monitors.

– user19496 – 2020-01-04T08:14:28.220

6

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.

Peter

Posted 2018-02-06T08:00:26.150

Reputation: 61

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 – 2019-01-22T16:18:32.277

3Now having this problem with to identical monitors connected to two DisplayPorts. – queezz – 2019-03-22T06:46:45.517

I too am now suddenly having this issue after switching from 2 old hdmi to new 2 displayport monitors! – John Gardner – 2019-05-04T00:02:24.613

For me the monitor that is connected through DVI is the dominant one, compared to two others, which use DisplayPort. – BluE – 2019-07-10T12:14:45.397

-1

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.

wiktor.wandachowicz

Posted 2018-02-06T08:00:26.150

Reputation: 34

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. – wiktor.wandachowicz – 2020-01-16T08:41:05.110