Solved

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

Posted on 2010-11-14
10
521 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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