Invisible Windows

This is a quick tip on how to resolve what can be a totally baffling experience, at least the first time you encounter it, it’s been around since day 1 and I just had it occur again on Windows 7 with a RemoteApp .NET application…

You launch an application and you can see it on the task bar (or just in Task Manager in the days before Windows 95) so you know it’s running, but there is no window displayed on the screen – you can select and interact with it through the keyboard, but where is it?

Assuming a single monitor for simplicity, the top-left corner is (0,0) in the 2D plane of the desktop, with the x ordinate increasing to the right and the y ordinate increasing down.

Below is an illustration of a 320x240 physical screen (the grey box) and 3 application windows rendered on the virtual desktop, and their top-left coordinates displayed:

virtual_desktop

This is to show that the virtual desktop is much bigger than the physical display, and it is possible for ordinates to go negative (otherwise windows would not be draggable off the left or top sides of the screen) – the green application window is the only one visible to the user.

Some applications keep a record of their virtual desktop properties – in particular the coordinates of the top-left corner and the x,y dimensions – which allows them to always open in the same position when the user launches them.

 

So how can windows end up on the virtual desktop in a position not rendered by the physical display?
- application writes incorrectly to the registry to store its position/size
- change of screen resolution reduces the rendered area
- number or position of physical screens changes*

In my case today, the RemoteApp application remembered its position as on the right-hand screen of a dual-display 1600x1200 setup, something like (2000,100) for its top-left corner – but I connected from a client with a single display of 1920x1200 resolution.

So the task appeared on Windows 7’s task bar as running, but I couldn’t see it.

 

* In a multi-display setup (0,0) is the top-left corner of the primary display, the default monitor used for full-screen apps, but it is perfectly valid to have additional screens above or to the left of the primary – this makes at least 1 ordinate of every pixel on these displays negative.

This is perfectly valid but something to bear in mind as I have had a couple of apps who assumed its windows and modal forms would have positive offsets, and behaved oddly if either ordinate was negative.

 

How to resolve this, if you can’t click on the title bar of the window to drag it into the display?
(This is not specific to RemoteApps, and has been a trick I have used since Windows 3.1 days.)

For Windows 95-Vista, right-click the task in the task bar and click Move, then tap a directional arrow key on the keyboard once, then move your mouse – you will find the application window is attached to the mouse cursor until you click to drop it.

For Windows 7 you do the same, but right-click the preview window itself (right-clicking the task will display the jump list, which is just “Close window” for RemoteApps).

Just make sure the window is not minimized first ;)

Alternatively, if you know where the application stores its data in the registry, you could edit the position whilst the app is not running – but there is no way to know for sure where this information is stored, or in what format (it could be a tiny part of a giant binary blob, for example).

(Remember that RemoteApps will be looking at the registry on the remote machine, too!)