473,797 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4841
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.Vi sible=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.goo glegroups.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.Visi ble = false in both my
MainForm_Closin g event and in my MainForm.Dispos e() 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*****@forwar dtechnology.net > wrote in message
news:qu******** ************@co mcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Vi sible=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*****@forwar dtechnology.net > wrote in message
news:8I******** ************@co mcast.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.Visi ble = false in both
my MainForm_Closin g event and in my MainForm.Dispos e() 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*****@forwar dtechnology.net > wrote in message
news:qu******** ************@co mcast.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?

Environme nt 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***@blogentr y.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****@hyperco n.net> wrote in message
news:OB******** ********@tk2msf tngp13.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.Visi ble = false in both
my MainForm_Closin g event and in my MainForm.Dispos e() 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*****@forwar dtechnology.net > wrote in message
news:qu******** ************@co mcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Vi sible=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****@hyperco n.net> wrote in message
news:eO******** **********@TK2M SFTNGP12.phx.gb l...
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***@blogentr y.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****@hyperco n.net> wrote in message
news:OB******** ********@tk2msf tngp13.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.Visi ble = false in both
my MainForm_Closin g event and in my MainForm.Dispos e() 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*****@forwar dtechnology.net > wrote in message
news:qu******** ************@co mcast.com...
What you can do in your exit() routine is to do a:

WSNotifyIcon.Vi sible=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.SQUA REBRACKETS.[mdaudi100#ntlwo rld.com]> wrote in
message news:eO******** *******@TK2MSFT NGP09.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****@hyperco n.net> wrote in message
news:eO******** **********@TK2M SFTNGP12.phx.gb l...
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***@blogentr y.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****@hyperco n.net> wrote in message
news:OB******** ********@tk2msf tngp13.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.Visi ble = false in
both my MainForm_Closin g event and in my MainForm.Dispos e() 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*****@forwar dtechnology.net > wrote in message
news:qu******** ************@co mcast.com...
> What you can do in your exit() routine is to do a:
>
> WSNotifyIcon.Vi sible=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

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

Similar topics

0
1594
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 reference not set to an instance of an object." and then
10
2583
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 above the task bar. Can't figure out why that happens - it looks very ugly... Any ideas ? Zeljko
0
1314
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 the tray icon to the new Icon a new icon appears in the system tray next to the original icon and the new icon will not resond to any events. Has anyone seen this?? Code snippet.... private Icon mDirIcon = new...
0
1341
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 that the only event I've been able to fire for a MenuItem is the CLICK event. I 've been unable to get the or Popup events to fire. I've tried adding handlers for the and Popup events, but that didn't work. I've also tried using menuitems as...
1
998
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 click only. Is there a way around this or am I missing something. Thanks, Norm
8
5269
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 started with a standard console application and it all works fine, except that it does not terminate tidily when the user logs off/shuts down. So, I figured I needed a message loop to pick up WM_QUIT. I studied the code in "Waiting in a message loop"...
2
2144
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
2085
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 steps to recreate my problem are as follows: Start a new c# windows application
1
4308
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. From your codes, I think the logical is, every time the Timer's elapsed event fires, we call the Check_For_Version_Update() function. From the Check_For_Version_Update() function, we judge a condition statement, and determine whether to call...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.