• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

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

How can i restore my application from taskbar in c#?
0
juliodiz
Asked:
juliodiz
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Under what conditions?

Maybe something like?

            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
            }
0
 
Subrat (C++ windows/Linux)Software EngineerCommented:
There is one property, ShowInTaskBar.....
If you want to show your UI in taskbar, you can make it true else false.
0
 
juliodizAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
If the application is not the foreground window then you also need to use the SetforegroundWindow() API to bring it to the front.
0
 
juliodizAuthor Commented:
So

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

?


0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
juliodizAuthor Commented:
Didnt work  , not restore from the task bar

he stays in the taskbar minimized.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
juliodizAuthor Commented:
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
 
Shahan AyyubSenior Software Engineer - iOSCommented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now