I have a Windows.Forms Application "MyMainApp" (C# / .Net 4.0) which runs on Windows 7.
There is a second programm running at the same time, but the "MyMainApp" must always be visible and is started as TopMost.
I have the problem, that sometimes the "MyMainApp" disappears behind the second program “MySecProg”.
I found out that this happens, if another window “PopUpWindow” from a background process pops up as top most (f.e. Printing messages).
If I close the “PopUpWindow”, then "MyMainApp" stays behind the “MySecProg”. With Alt+Tab I can bring the focus to "MyMainApp" again and it comes to the front. It also stays at the front afterwards, what means that it is still TopMost.
What can I do, that "MyMainApp" does not disappear, if another window pops up?
Thanks for your help!!
FYI: This is a Question that was already answered. The accepted solution improofed the situation, but didn't solve it :-).
this.Deactivate += new System.EventHandler(this.Form1_Deactivate);
private void Form1_Deactivate(object sender, EventArgs e)