Solved

How can i restore my application from taskbar in c#?

Posted on 2010-11-14
10
524 Views
Last Modified: 2012-05-10
How can i restore my application from taskbar in c#?
0
Comment
Question by:juliodiz
10 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34133217
Under what conditions?

Maybe something like?

            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
            }
0
 
LVL 9

Expert Comment

by:Subrat (C++ windows/Linux)
ID: 34133380
There is one property, ShowInTaskBar.....
If you want to show your UI in taskbar, you can make it true else false.
0
 

Author Comment

by:juliodiz
ID: 34133392
I try


        if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
            }

But didnt work.

Because when have a problem if the application is minimized i need to restore to the user see the problem.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34133471
If the application is not the foreground window then you also need to use the SetforegroundWindow() API to bring it to the front.
0
 

Author Comment

by:juliodiz
ID: 34133475
So

        if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
                SetforegroundWindow();
            }

?


0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 300 total points
ID: 34133669
You have to import it:

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern int SetForegroundWindow (IntPtr hwnd);

        ...
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
                SetForegroundWindow(this.Handle);
            }
0
 

Author Comment

by:juliodiz
ID: 34133979
Didnt work  , not restore from the task bar

he stays in the taskbar minimized.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34133989
Does the taskbar by chance blink?

If not, give us more details about the setup and the conditions under which you need the app to restore.
0
 

Author Comment

by:juliodiz
ID: 34134002
I have a form Logado, and i need when have a problem the operator see the problem, but if the program is minimzed the operator will not see the problem.

So i need to restore the form from the taskbar
0
 
LVL 19

Assisted Solution

by:Shahan Ayyub
Shahan Ayyub earned 200 total points
ID: 34141082
Why not you use this(Form1_Resize) event:

private void Form1_Resize(System.Object sender, System.EventArgs e)
{
	if (this.WindowState == FormWindowState.Minimized)
        {
		this.WindowState = FormWindowState.Normal;
	}
}

Open in new window


So whenever the window will be minimized it will be restore.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 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