Link to home
Start Free TrialLog in
Avatar of ICSAutomation
ICSAutomationFlag for Switzerland

asked on

Windows.Forms TopMost is lost

Hello

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 :-).

first solution:
this.Deactivate += new System.EventHandler(this.Form1_Deactivate);
private void Form1_Deactivate(object sender, EventArgs e)
        {
            this.Activate();
        }
ASKER CERTIFIED SOLUTION
Avatar of SStory
SStory
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial