Solved

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

Posted on 2010-11-14
10
523 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 8

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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

791 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