Crash when minimizing to tray

Oct 5, 2011 at 8:59 AM
Edited Oct 5, 2011 at 9:00 AM

Hi, I would like to say, thats this wrapper ist very very useful. I love it.

But there is a crash, when trying to minimize the Application to the tray area. It says "out of memory". Is there a solution for this?

I am doing this:

 

if (FormWindowState.Normal == WindowState)

    Hide();

ShowInTaskbar = false;

 Then the application crashes. I haven´t seen anything wrong in the sorces. So, is there anybody, who can help?

Regards
hullihulli

 

Oct 5, 2011 at 9:03 AM

That’s interesting….

I’m not entirely sure how that code will minimize your application to the notification area…

A simple way to minimize to tray is to handle the Resize event on your form and check the WindowState is equal to Minimized.

If so, set ShowInTaskbar to false. There is no need to call Hide() on the window.

Oct 5, 2011 at 10:44 AM

Hi tompsonn, thanks for the reply.

I thought I needed that Hide(), because i want to minimize my main window to the tray by clicking a ribbon button (its like a start button for more things to do and one part is hiding the window).

But you are right. when you do 

this.WindowState = FormWindowState.Minimzied;

then it will do the same.

Thanks

hullihulli

 

Oct 5, 2011 at 10:51 AM

Ah I see now. Yes, that will suffice. May as well let Windows take care of the window hiding for you J