[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2010-11-14
10
Medium Priority
?
534 Views
Last Modified: 2012-05-10
How can i restore my application from taskbar in c#?
0
Comment
Question by:juliodiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 86

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
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!

 
LVL 86

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 86

Accepted Solution

by:
Mike Tomlinson earned 1200 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 86

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 800 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 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