¶How to recover an off-screen window
For a long time, I've been a single-monitor user, mainly because I've usually only had one monitor to use. This has only been reinforced by my transition to laptops. I'd tried dual monitors on a desktop before, and didn't like it at first, but once I figured out that you can run two monitors without spanning them -- which often requires a reboot to get working since monitor detection in Windows is lame -- I've gotten accustomed to it. Span mode sucks with two monitors because everything tends to pop up exactly between the monitors. With plain old two-monitor mode, though, windows maximize on a per monitor basis and everything works a bit better.
Except when you enable or disable monitors.
Applications like to save their window location on exit, because users don't like to constantly have to resize the window on startup. (I grudgingly fixed this in VirtualDub a while back.) The tricky part is making sure that the application never ends up trying to restore a position off-screen, because it's almost impossible to get the window back. You're supposed to use SetWindowPlacement() to restore the window position, as it automatically adjusts the window position if this were the case. Frequently applications don't do this, though, and thus you get a bunch of likely failure cases, all of which result in the app restoring off-screen: the desktop resolution is lowered, a monitor is disabled or moved, or the app uses the wrong function and derives deep negative coordinates from a minimized window. As I tend to use Remote Desktop and do resolution testing a lot, I often hit these cases. WinAmp's a frequent victim.
There is a trick to rescuing such windows, though, as long as they appear on the taskbar or can otherwise be selected. I used to do Minimize All + Undo Minimize All (now Show the Desktop + Show Open Windows), but that wasn't very reliable. I've since found a better way to do it:
- Right-click on the window caption on the taskbar, or select it and use Alt+Space.
- If the Restore option is available, select it to pop the window out of minimized or maximized state.
- Choose the Move option.
- Hit an arrow key.
- Move the mouse.
The window should then pop on-screen and attach to the mouse, where it can then be dropped at a usable location via left-click.