Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,130 | Comments: 45,558

filter by tags archive

It ain’t no simple feature, mister

time to read 1 min | 183 words

I recently got a bug report about NH Prof in a multi monitor environment. Now, I know that NH Prof works well in multi monitor environment, because I frequently run in such an environment myself.

The problem turned out to be not multi monitors in and of itself, but rather how NH Prof handles the removal of a monitor. It turns out that NH Prof has a nice little feature that actually remembers the last position the window was at, and returns to it on start. When the monitor NH Prof was located on was removed, on start NH Prof would put itself beyond the screen position.

That led to me having to figure out how to find the available monitor space, so I could detect if the saved positions were valid or not. What I found interesting in this is that what seemed to be a very trivial feature (save two numbers) turned out to be somewhat more complex, and I am pretty sure that there are other scenarios that I am missing (in the very same feature).


Filip Navara

Ah, reinventing the Win32 wheel - Get/SetWindowPlacement - is it not available in some form in WPF?


You should also check the weight and width of your windows and check if they still fit. If the desktop is accessed using RDP the desktop dimensions could also change.

In our office dual 22" screens are used, but some employees use 17" laptops to work on the road. Nobody said development was easy..

John Chapman

I doubt you'll run into this with your users, but Windows will also allow non-rectangular desktops. I have seen users that have 4 monitors mounted as a rectangle with 2 on the bottom and 2 on top and then 2 more monitors one on each side.

Perhaps it's flexibility like that which makes it more complicated than 2 numbers?

Also when 2 monitors do not share the same resolution you also have the flexibility of placement for the monitors. Is the smaller monitor in the middle, bottom, top?

These configurations make it seem less than trivial.

Wyatt Barnett

If it makes you feel any better, lots of programs by big publishers also fail when you take away monitors.

Alex Simkin

@John Chapman and Wyatt Barnett

With setup like this users so used to everything not working correctly that NHProf won't make their lives any different.


This is a problem with many windows apps. There must be some tool out there that can bring lost windows onto the screen. For your app I'd suggest a "Forget window positiions" menu action.

Rik Hemsley

TBH this is exactly the sort of thing that developers are supposed to think about and cater for before it happens. Windows is perfectly capable of ensuring that your app is visible when it starts, and you know that the desktop could be spread over multiple screens - and that the configuration may change.

To blithely override the default positioning while ignoring the obvious issues involved - well, I can only say I would be disappointed if any of our developers did the same.


This issue drives me crazy with other applications when I undock my laptop...


Never have an issue with losing windows.

With Ultramon, using Windows 7. On the main taskbar, you hover over the taskbar item to bring up the preview, right click the preview and click "Move to other monitor".

Problem solved.

Dave H

Just my opinion here but I would put a bug like this pretty low on my priority list. As other people have said, lots of other apps have this issue so even if your app works fine, other apps will break anyway so the end user will have some tidying up to do.

You can also work around the problem to some extent as long as the app's still visible in the task bar: right click the task, select move, press a cursor key and wave your mouse around and the window will come back into the visible area.


The good thing is that since it is open source, you will not have to lose sleep fixing it. Plus, probably someone else may fix it for you.

Pure Krome

For me .. i find that when i Remote Desktop from home to my work PC .. this happens a fair bit :( this is why i make sure i change all my settings/move windows to the primary monitory if i know i'm going to RD to my work machine.

For VS2010 (and i did this for VS2008) i have two window settings -> one for single monitory and another for dual 22" monitors. This is because i'm switching so often between the two.

Thank gawd VS2010 now displays the window positions exactly right when i import the display windows .. in vs2008 it always skewed them off to by 100 px or something. so fraking annoying.


To move a lost window back to the monitor without UltraMon and similar programs just right click on the program in the taskbar, use move command, move mouse back to the monitor and press left or right arrow in the keyboard. The window will jump under the cursor.

Comment preview

Comments have been closed on this topic.


  1. How to waste CPU and kill your disk by scaling 100 million inefficiently - 11 hours from now
  2. RavenDB Conference 2016–Slides - about one day from now

There are posts all the way to Jun 01, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats