Solved

Windows.Forms TopMost is lost

Posted on 2013-01-08
1
1,390 Views
Last Modified: 2013-02-25
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();
        }
0
Comment
Question by:ICSAutomation
1 Comment
 
LVL 25

Accepted Solution

by:
SStory earned 300 total points
ID: 38859715
http://stackoverflow.com/questions/683330/how-to-make-a-window-always-stay-on-top-in-net

Have you tried setting the .owner property as the above article suggests (last paragraph).
You need to make sure the on top app is owned by your other window, then you can keep it on top of your own window. There is no way to make a top most that is always above other windows that another app sets to topmost.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now