Click here to Skip to main content
15,886,781 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi I hope someone will be able to solve my problem...
I develop winForm application,
when it being minimized - it's supposed to appear as an icon instead of taskbar. My code:
C#
private void BaseForm_SizeChanged(object sender, EventArgs e)
        {
            notifyIcon1.BalloonTipTitle = "Our Program";
            notifyIcon1.BalloonTipText = "still working... ";

            if (FormWindowState.Minimized == this.WindowState)
            {
                notifyIcon1.Visible = true;
                this.ShowInTaskbar = false;
                notifyIcon1.ShowBalloonTip(500);
            }
            else if (FormWindowState.Normal == this.WindowState)
            {
                notifyIcon1.Visible = false;
            }
        }


C#
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            notifyIcon1.Visible = false;
            this.WindowState = FormWindowState.Normal;
            this.Show();
            Login loginFrm = new Login();
            loginFrm.ShowDialog();

        }


Now something strange happends: the program is being minimized as requested,
but when I want to double-click the icon - it disappears !!
Means: When my mouse arrow hover on the icon (without any click!) - the icon is gone and
never come back, so that I have to run the application from the begining.
I'll just mention 2 notes:
1. I've checked - there's no any Hover Event active.
2. I've checked the code in separate project and it was fine.

Can someone tell me what's going on? And what can I do?

I'll appriciate your help.
Tali.
Posted

1 solution

Check in TaskManager and make sure your app is still running before you launch another one.

Once you determine if the app is still running or not, then you can proceded with trying to figure out what happened.
 
Share this answer
 
Comments
Member 7928594 4-Jun-11 18:14pm    
Well, you're right!
The application is no more running after minimize.
Why? Do you have any advice?
Dave Kreskowiak 4-Jun-11 19:46pm    
Now, what's is your code doing in the Form.Activate, .Paint, .Resize events? Or any other Form events? Do you have any COM-based controls on the form? Does it happen every time or only after the app has been running for a while??
Member 7928594 4-Jun-11 20:05pm    
So...
a. I don't have any special code for resize, except the code I mentioned before (- for sizeChanged event),and the Load event (did I miss something?)
b. the form is very simple and have only tool-strip-menu but actually never being used because all the other forms inherits it.
c. It happends EVERY time, immediately. Therefore I could never check the double-click event yet.
Dave Kreskowiak 4-Jun-11 23:05pm    
Well, you haven't given us anything to go on. What else is this app doing?
Member 7928594 5-Jun-11 2:30am    
this application includes Login form, this Base form, Main form (the few others doesn't matter). except the Login form, all the forms extends the Base form. The Main form has 2 threads - one will popup the Login form every few minutes, the other will play music using windows media player (is this the COM component you looked for?).
But I think that this phenomenon started before I added the threads. Is there any connection to windows media player tool?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900