Author Topic: Recovering "lost" main window  (Read 4318 times)


  • Community Member
  • Posts: 22
  • Hero Points: 3
Recovering "lost" main window
« on: August 19, 2006, 06:20:39 pm »
VS (like virtually all Windows apps that try to "nicely" restore window size/position
for you) fails to deal with an obscure case that goes something like this:

a) add a 2nd monitor to your machine
b) use VS on the 2nd monitor
c) have the 2nd monitor die

At that point, because VS is not smart enough to notice that it
is now restoring the main window to coordinates that are no longer
visible, you can start VS, but you can't see it. If you go to the taskbar,
you can right-click and select Maximize, which will produce a maximized
VS window on one of your remaining monitors. Maddeningly, however,
you cannot "restore" to use VS in any size except maximized,
since that will simply cause VS to once again display the window
in coordinates that are not actually visible.

For my own apps, I add a system context menu item called
"Center Window" so that if, for this or any other obscure reason,
the customer can't find the window, I can at least tell them how
to right-click on the taskbar icon to force the window to be splatted
in the middle of the primary monitor.

But, for today... can anyone tell me where I can locate and hammer
the (now invalid) main window restore coordinates that VS is using?


  • Senior Community Member
  • Posts: 2432
  • Hero Points: 322
Re: Recovering "lost" main window
« Reply #1 on: August 19, 2006, 11:48:08 pm »

They're in vrestore.slk.
I don't know whether there's also a copy of this info in the state file vslick.sta.

Look in restore.e in slick macros directory line 893 you'll see

   // SCREEN: must be first item in vrestore.slk because vs executable
   // expects this line to be first.  This is because vs creates
   // the MDI window visible.  This is likely to change in the future.
   _str screen_line='SCREEN: '_screen_width()' '_screen_height()' 'mdi_x' 'mdi_y' 'mdi_width:+
                   ' 'mdi_height' 'mdi_ix' 'mdi_iy' 'window_state' 0 0 0 0 'mdiclient_width' 'mdiclient_height;

so for me I get
1680 1050 156 235 1098 774 0 0 N 0 0 0 0 886 630

The N changes to an M for maximised.
156 235 are x y
1098 774 are width height
886 630 are client width height

On windows you can move a window using system menu  - press ALT space, then M, then use arrow keys to move the window.  You can resize with ALT space then S then arrow keys.
You should also be able to use the taskbar option to cascade windows or tile windows.  You can also select which windows participate in the cascading or tiling by clicking the taskbar icon for the first one, then control click other ones to add them to the "list".



  • Community Member
  • Posts: 22
  • Hero Points: 3
Re: Recovering "lost" main window
« Reply #2 on: August 21, 2006, 09:56:45 pm »
The keyboard move tricked work for me, with the addendum that hitting the Escape key instead of an arrow key pops the window back to its original position (and out of Move mode). When you don't know where, in the coordinate space (especially since GDI coordinates can and do go negative) the missing window is, you can end up just moving the window further away from ever being visible. By just trying every possible direction (I happened to know that the missing coords were not on a diagonal, else I would have had to include diagonal directions) and hitting the Escape key when they didn't work, I was able to find one that did bring the window into view.

Thanks for the tip!