473,383 Members | 1,739 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,383 software developers and data experts.

Dispose of Notifier Icon

Thank you in advance for any and all assistance.

I have an application that places a notifier icon in the start tray. When
the application closes, the icon appears to stay, till I place my mouse over
it and then it will disappear. Can someone point in the direction of code to
dispose of the notifier icon when the application closes?

Michael
Jul 24 '06 #1
6 1536
you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15
Jul 24 '06 #2
iwdu15

Keep it by your first answer, don't tell what you believe is. :-)

There are almost 10 methods to start a VB application.

If you use the standard method than the application exit is standard done in
your main form as that closes

If you write your own Sub Main to let the application run, than you have to
end that with application.exit.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteratyahoodotcomschreef in bericht
news:64**********************************@microsof t.com...
you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15

Jul 25 '06 #3
Iwdu15,
Just what I thought reading your message.
Maybe should I add: and am happy with the correct way you are helping
others.

:-)

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:Ok**************@TK2MSFTNGP04.phx.gbl...
iwdu15

Keep it by your first answer, don't tell what you believe is. :-)

There are almost 10 methods to start a VB application.

If you use the standard method than the application exit is standard done
in your main form as that closes

If you write your own Sub Main to let the application run, than you have
to end that with application.exit.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteratyahoodotcomschreef in bericht
news:64**********************************@microsof t.com...
>you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15


Jul 25 '06 #4
Michael,
In addition to the other comments.

Be certain to call Dispose on the NotifyIcon when you app exits, this
ensures that any unmanaged resources its holding are cleaned up. I would not
use the visible = false method as that is "hiding the icon" rather then
"clean up the resources"...

Do you have an forms application that happens to have a notify icon, or do
you happen to have a notify icon that happens to have a form?

When I have a notify icon that happens to have a form I normally do
something like:
http://groups.google.com/group/micro...48f2baa27752c8

http://groups.google.com/group/micro...98f02af50ca7de

http://groups.google.com/group/micro...b0f2a27479a427

If I had a forms application that happens to have a notify icon, I would be
certain to call dispose of the icon when the form closed (or the application
exited).

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.comwrote
in message news:8A**********************************@microsof t.com...
| Thank you in advance for any and all assistance.
|
| I have an application that places a notifier icon in the start tray. When
| the application closes, the icon appears to stay, till I place my mouse
over
| it and then it will disappear. Can someone point in the direction of code
to
| dispose of the notifier icon when the application closes?
|
| Michael
Jul 25 '06 #5
just a question for you, i havent done much reading on the memory management
of VB, but i was under the impression that VB was managed by the GC, so when
the application exits, there isnt anything associated with the NotifyIcon
object so the GC would collect it and release the resources....am i following
this wrong?
--
-iwdu15
Jul 25 '06 #6
iwdu15,
Yes managed resources are "managed" by the GC.

However NotifyIcon represents an unmanaged resource. The GC doesn't really
manage unmanaged resources.

Also remember that the GC, more appropriately any Finalizers may not execute
when the app exits. Ergo its best to call NotifyIcon.Dispose when you are
exiting.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"iwdu15" <jmmgoalsteratyahoodotcomwrote in message
news:C2**********************************@microsof t.com...
| just a question for you, i havent done much reading on the memory
management
| of VB, but i was under the impression that VB was managed by the GC, so
when
| the application exits, there isnt anything associated with the NotifyIcon
| object so the GC would collect it and release the resources....am i
following
| this wrong?
| --
| -iwdu15
Jul 25 '06 #7

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

Similar topics

2
by: Vic | last post by:
I am trying to change an icon associated with my application's main form and the application itself. 1. I selected my main form in IDE "Solution" tab and went to "Properties" window. 2. I found...
8
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
3
by: Nina | last post by:
Hi there, I assigned icon for a window's form using form's Icon property at design time. Now I want to change the icon. I tried to replace the old icon with the new icon using form's Icon...
0
by: Smokey Grindle | last post by:
I keep getting this message System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Icon'. at System.Drawing.Icon.get_Handle() at System.Drawing.Icon.get_Size()
3
by: Tom | last post by:
I am having a serious issue with my MDI child windows. This is with a large VB.NET application that I ported over to VS 2005 from VS 2003. The problem is that, if the child window is maximized and...
2
by: pigeonrandle | last post by:
Hi, I have a class with a handle to a window and a handle to its icon (if it has one). What do i need to do to correctly free these resources when my class is disposed? Cheers, James.
2
by: deciacco | last post by:
I have a NotifyIcon application. (c# 2) I want to be able to catch a kill/shutdown attempt so that I can call Dispose() to remove the icon. I tried to create an event handler for ApplicationExit...
4
by: Marcolino | last post by:
Hi, I have simple needs but I don't know how to implement it. I have application that create Dynamic Button. I need to set the image on this button, getting the icon from a form. So pratically...
1
by: sean.chapman | last post by:
I've got a portion of this program that has a timer setup. On the interval I am checking to see if some stuff is changed then want to play the exclamation sound until it has been noticed and...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.