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

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?

Solution:

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