Home All Groups Group Topic Archive Search About

Dispose of Notifier Icon

Author
24 Jul 2006 9:31 PM
eSolTec, Inc. 501(c)(3)
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

Author
24 Jul 2006 9:52 PM
iwdu15
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
Author
25 Jul 2006 5:41 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"iwdu15" <jmmgoalsteratyahoodotcom> schreef in bericht
news:64EC110E-B1F0-45E9-85F2-F7C9B3424CCC@microsoft.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
Author
25 Jul 2006 7:14 AM
Cor Ligthert [MVP]
Iwdu15,

> Just what I thought reading your message.

Maybe should I add: and am happy with the correct way you are helping
others.

:-)

Cor

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht
news:Ok94Xz6rGHA.4884@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" <jmmgoalsteratyahoodotcom> schreef in bericht
> news:64EC110E-B1F0-45E9-85F2-F7C9B3424CCC@microsoft.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
>
>
Author
25 Jul 2006 12:22 PM
Jay B. Harlow [MVP - Outlook]
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/microsoft.public.dotnet.languages.vb/browse_frm/thread/7a56084f2742290a/0f48f2baa27752c8?lnk=st&q=&rnum=1#0f48f2baa27752c8

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_frm/thread/ab3197ca97e2c7f6/4998f02af50ca7de?lnk=st&q=&rnum=2#4998f02af50ca7de

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_frm/thread/f17bad2be671b5d4/ddb0f2a27479a427?lnk=st&q=&rnum=3#ddb0f2a27479a427

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


Show quoteHide quote
"eSolTec, Inc. 501(c)(3)" <eSolTecInc50***@discussions.microsoft.com> wrote
in message news:8A9390F4-72FC-409F-BE3E-BE57FC9BC108@microsoft.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
Author
25 Jul 2006 12:41 PM
iwdu15
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
Author
25 Jul 2006 11:01 PM
Jay B. Harlow [MVP - Outlook]
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


Show quoteHide quote
"iwdu15" <jmmgoalsteratyahoodotcom> wrote in message
news:C22C47D2-60D0-4B53-BC48-C0EC2A976482@microsoft.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