473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

NotifyIcon Problem

My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons so
that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd solution.
How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM
Nov 16 '05 #1
10 4804
This happens for me to. If you scroll over the icon and away from it,
it will disappear (if the app is no longer running). I believe it is a
bug in the framework.

Nov 16 '05 #2
What you can do in your exit() routine is to do a:

WSNotifyIcon.Visible=false;

which will hide and remove the icon from the tray. Now when you run the
app again there will not be several ghosted icons behind.

james wrote:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons so
that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd solution.
How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM

Nov 16 '05 #3
This only work some of the time for me. It does not seem to work when I
have a lot of them, only when I have one or two, not 10

thanks,

JIM

"Poietes" <yk******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
This happens for me to. If you scroll over the icon and away from it,
it will disappear (if the app is no longer running). I believe it is a
bug in the framework.

Nov 16 '05 #4
Greg,

What is the WS for? Anyway, which exit() routine are you referring to.
..Net Framework does not have exit() that I can find. Anyway, I should point
out that I already do have have NotifyIcon.Visible = false in both my
MainForm_Closing event and in my MainForm.Dispose() but when developing
inside VisualStudio, I do not think these get fired properly when I kill the
app by clicking the STOP button. Any other suggestions?

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:qu********************@comcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Visible=false;

which will hide and remove the icon from the tray. Now when you run the
app again there will not be several ghosted icons behind.

james wrote:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons
so that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd
solution. How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM


Nov 16 '05 #5
Greg,

I downloaded your test tray app, and I find that it does the same thing.
Your icon does not go away either WHEN you kill the app from visual studio.
If you read my message below and try it yourself you will see what I mean

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:8I********************@comcast.com...
The WS part is just what I named my NotifyIcon class. I place mine in the
forms exit() method. Set your method up in the this.closing += with your
own custom exit handler. Place the icon hide code in there and see what
happens.

Strange thing is, I've written a few apps that hide the icon and some that
dont' yet the icon always goes away when the application ends. It's
possible there is a bug of some kind in .net.

I have an example of a quick tray app with an xp style ballon tool-tip and
it does not clear out the tray flag yet on this.close() the icon
disappears. The example is at:

http://blog.forwardtechnology.net/gm...icles/194.aspx

Can you post or e-mail me your NotifyIcon setup code section?

james wrote:
Greg,

What is the WS for? Anyway, which exit() routine are you referring to.
.Net Framework does not have exit() that I can find. Anyway, I should
point out that I already do have have NotifyIcon.Visible = false in both
my MainForm_Closing event and in my MainForm.Dispose() but when
developing inside VisualStudio, I do not think these get fired properly
when I kill the app by clicking the STOP button. Any other suggestions?

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:qu********************@comcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Visible=false;

which will hide and remove the icon from the tray. Now when you run the
app again there will not be several ghosted icons behind.

james wrote:

My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons
so that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd
solution. How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM


Nov 16 '05 #6
Sean,

When developing a fairly large application it is just not always feasable to
Exit the application gracefully when debugging. For example, often times I
am stepping way down deep into code when I come accross an obvious codeing
error that I simply fix on the fly, kill the app and re-start to check the
fix. Now if I were to continue running the app until I can get back to a
main menu to exit gracefully, for the 300th time in a day I would get very
little done in a day. Also, in my app, the Exit menu fires a bunch of code
that saves state to the registry and sometimes I want to avoid that - plus
it is time consuming.

thanks,

JIM

"Sean Hederman" <us***@blogentry.com> wrote in message
news:cs**********@ctb-nnrp2.saix.net...
JIM,

When you click the Stop icon in Visual Studio, it shuts down the entire
application immediately without calling any closing or cleanup code.
Rather try closing your application the way your users would, and then if
your cleanup code makes the tray icon invisible, it should disappear.

Regards

--
Sean Hederman

http://codingsanity.blogspot.com

"james" <no****@hypercon.net> wrote in message
news:OB****************@tk2msftngp13.phx.gbl...
Greg,

What is the WS for? Anyway, which exit() routine are you referring to.
.Net Framework does not have exit() that I can find. Anyway, I should
point out that I already do have have NotifyIcon.Visible = false in both
my MainForm_Closing event and in my MainForm.Dispose() but when
developing inside VisualStudio, I do not think these get fired properly
when I kill the app by clicking the STOP button. Any other suggestions?

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:qu********************@comcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Visible=false;

which will hide and remove the icon from the tray. Now when you run the
app again there will not be several ghosted icons behind.

james wrote:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons
so that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd
solution. How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM


Nov 16 '05 #7
When you hit the stop button, move your mouse over the icon in the System
Tray and it will dissapear.

The stop button kills your app and so does not clean up the NotifyIcons Icon
as you told it to skip everything and just stop.

Would you prefer that when you hit the stop button that it tried to clean
up? In that case there would be no difference to terminating your app
cleanly.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"james" <no****@hypercon.net> wrote in message
news:eO******************@TK2MSFTNGP12.phx.gbl...
Sean,

When developing a fairly large application it is just not always feasable
to Exit the application gracefully when debugging. For example, often
times I am stepping way down deep into code when I come accross an obvious
codeing error that I simply fix on the fly, kill the app and re-start to
check the fix. Now if I were to continue running the app until I can get
back to a main menu to exit gracefully, for the 300th time in a day I
would get very little done in a day. Also, in my app, the Exit menu fires
a bunch of code that saves state to the registry and sometimes I want to
avoid that - plus it is time consuming.

thanks,

JIM

"Sean Hederman" <us***@blogentry.com> wrote in message
news:cs**********@ctb-nnrp2.saix.net...
JIM,

When you click the Stop icon in Visual Studio, it shuts down the entire
application immediately without calling any closing or cleanup code.
Rather try closing your application the way your users would, and then if
your cleanup code makes the tray icon invisible, it should disappear.

Regards

--
Sean Hederman

http://codingsanity.blogspot.com

"james" <no****@hypercon.net> wrote in message
news:OB****************@tk2msftngp13.phx.gbl...
Greg,

What is the WS for? Anyway, which exit() routine are you referring to.
.Net Framework does not have exit() that I can find. Anyway, I should
point out that I already do have have NotifyIcon.Visible = false in both
my MainForm_Closing event and in my MainForm.Dispose() but when
developing inside VisualStudio, I do not think these get fired properly
when I kill the app by clicking the STOP button. Any other suggestions?

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:qu********************@comcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Visible=false;

which will hide and remove the icon from the tray. Now when you run
the app again there will not be several ghosted icons behind.

james wrote:
> My app has a notify Icon, but after the app exits, the Icon is still
> visible, and then when I runthe app multiple times I get multiple
> icons so that my status bas keeps accumulating them to the point it
> becomes un-usable. The only fix I have found is to re-boot. Not a
> godd solution. How do I get this to stop happening?
>
> Environment C#, VS.Net 2003, XP Pro
>
> Thanks,
>
> JIM
>



Nov 16 '05 #8
If this means that you forces the application to shut down from Visual
Studio, then there is no way you can catch that and clean up the system
tray in your code.

But you don't have to reboot, just move your pointer over the icon and
it will go away.

Regards,
Joakim

james wrote:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons so
that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd solution.
How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM

Nov 16 '05 #9
No, what I would prefer is that the Garbage Collector would recognize that
the app the created the Notify Icon is no longet running and clean up the
Icon. Or at least the Icon should be smart enough to know that its app is
gone and clean itself up. It would be the proper thing to do, but then...

JIM

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:eO***************@TK2MSFTNGP09.phx.gbl...
When you hit the stop button, move your mouse over the icon in the System
Tray and it will dissapear.

The stop button kills your app and so does not clean up the NotifyIcons
Icon as you told it to skip everything and just stop.

Would you prefer that when you hit the stop button that it tried to clean
up? In that case there would be no difference to terminating your app
cleanly.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"james" <no****@hypercon.net> wrote in message
news:eO******************@TK2MSFTNGP12.phx.gbl...
Sean,

When developing a fairly large application it is just not always feasable
to Exit the application gracefully when debugging. For example, often
times I am stepping way down deep into code when I come accross an
obvious codeing error that I simply fix on the fly, kill the app and
re-start to check the fix. Now if I were to continue running the app
until I can get back to a main menu to exit gracefully, for the 300th
time in a day I would get very little done in a day. Also, in my app,
the Exit menu fires a bunch of code that saves state to the registry and
sometimes I want to avoid that - plus it is time consuming.

thanks,

JIM

"Sean Hederman" <us***@blogentry.com> wrote in message
news:cs**********@ctb-nnrp2.saix.net...
JIM,

When you click the Stop icon in Visual Studio, it shuts down the entire
application immediately without calling any closing or cleanup code.
Rather try closing your application the way your users would, and then
if your cleanup code makes the tray icon invisible, it should disappear.

Regards

--
Sean Hederman

http://codingsanity.blogspot.com

"james" <no****@hypercon.net> wrote in message
news:OB****************@tk2msftngp13.phx.gbl...
Greg,

What is the WS for? Anyway, which exit() routine are you referring to.
.Net Framework does not have exit() that I can find. Anyway, I should
point out that I already do have have NotifyIcon.Visible = false in
both my MainForm_Closing event and in my MainForm.Dispose() but when
developing inside VisualStudio, I do not think these get fired properly
when I kill the app by clicking the STOP button. Any other
suggestions?

Thanks,

JIM
"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:qu********************@comcast.com...
> What you can do in your exit() routine is to do a:
>
> WSNotifyIcon.Visible=false;
>
> which will hide and remove the icon from the tray. Now when you run
> the app again there will not be several ghosted icons behind.
>
> james wrote:
>> My app has a notify Icon, but after the app exits, the Icon is still
>> visible, and then when I runthe app multiple times I get multiple
>> icons so that my status bas keeps accumulating them to the point it
>> becomes un-usable. The only fix I have found is to re-boot. Not a
>> godd solution. How do I get this to stop happening?
>>
>> Environment C#, VS.Net 2003, XP Pro
>>
>> Thanks,
>>
>> JIM
>>



Nov 16 '05 #10
If the system is smart enough to Dealloc the Icon when you move your mouse
over it then why cant the system be smart enough to remove the icon when the
app is killed. The operating system is aware of this event.

JIM
"Joakim Karlsson" <jk*******@NOSPAMjkarlsson.com> wrote in message
news:uI******************@tk2msftngp13.phx.gbl...
If this means that you forces the application to shut down from Visual
Studio, then there is no way you can catch that and clean up the system
tray in your code.

But you don't have to reboot, just move your pointer over the icon and it
will go away.

Regards,
Joakim

james wrote:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons
so that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd
solution. How do I get this to stop happening?

Environment C#, VS.Net 2003, XP Pro

Thanks,

JIM


Nov 16 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: petterl | last post by:
I have tried to find the error in the code below but I always get " An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module. Additional information: Object...
10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
0
by: Dick Abram | last post by:
I have a project that uses the NotifyIcon to put an icon in the system tray. At some point in the application I change the .Icon property of the object to another Icon object but instead of changing...
0
by: ZH | last post by:
Hi There, I have an application that runs from the systray. When the user right clicks on the icon it shows the user a list of of menu items. That works without a problem. The problem is...
1
by: Norm | last post by:
Is it possible to display two separate lists on a ContextMenu with a right or left click on the tray icon. It appears that the default function of NotifyIcon is to show the context menu on right...
8
by: Dave | last post by:
I am trying to write an event-driven application with no main window that runs "forever". It waits on a named event and then displays a window depending on data pased in a memory-mapped file. I...
2
by: JR | last post by:
Hi, I need to change the notifyicon in a countdown. after about 3000-5000 times there is an error. Here is all the code. what is wrong please help
2
by: stillcoding | last post by:
Hi I have a problem with memory usage increasing when I right click to display the context menu on a notifyIcon OS: Windows XP Professional SP2 Software: VS2005 Professional edition SP1 The...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.