Windows Forms, .net 2.0
My main application thread has a form (A). I have a background thread which operates off a timer to determine that an activity has taken place - when it does, it causes the main application form to hide (using BeginInvoke), and creates a new form (B) in its own thread (seperate message pump).
The two threads thing sounds complicated, but it is needed unfortunately.
The new form, on the new message pump is shown at the top of the non-topmost forms (as you would expect!). However, if the original application wasn't on top of the desktop this is very annoying.
So, I would like to determine what the z-order of the original form (A) is before hiding it; then create my new form (B) mirroring the z-order of the original form.
Any ideas?
[This also has the side effect of form B popping up over a screen-saver if it is on the current users desktop (ie non passworded), which if I can't fix it how I would like above, I would like to avoid this...]