When you undock your computer, the windows on your external monitor are minimized. When you re-dock your computer to your monitor, Windows puts everything back exactly where you had it before.
Find the settings for these features
-
Select Start > Settings > System > Display.
-
Scroll down and select Multiple displays to expand that section.
-
Select the boxes for Remember window locations based on monitor connection and Minimize windows when a monitor is disconnected.