When the taskbar is recreated, the system sends the registered window
message "TaskbarCreated" whose value you can get using
RegisterWindowMessage("TaskbarCreated");
You will need to catch this message and reinsert the tray icon
If you dont mind a commercial solution, you can try our ShellNotifyIcon
component at
http://www.ssware.com/shlobj/shlobj.htm
---------
- G Himangi, Sky Software
http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
"Patrick Dugan" <pa***********@usnetNOSMORESPAMcomcorp.comwrote in message
news:u4**************@TK2MSFTNGP02.phx.gbl...
>
The icon is embedded in the main program and it is called from an instance
in sub main. The problem is *sometimes* the icon will not show up if the
program is set to start when Windows boots up. The problem is rare but
nonetheless still happens on occassion. The question is how do I determine
that the system tray has started so I can wait to initialize the icon at
that point. I already know to look for a process but so far I cannot tell
what process indicates the system tray is up and running.
I also need to determine if Explorer crashes and the tray icons need to be
refreshed. How can you tell that has happened and you need to
re-establish the tray icon?
"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:uW*************@TK2MSFTNGP06.phx.gbl...
>Patrick,
You can handle this many ways, but here are a couple:
1) Check to see if the process is already running
2) Embed the icon in the executable
By continuing to create a new NotifyIcon object you are indeed using
memory
How are you starting this application?
Hopefully you are using a module with sub main, creating an instance of
your
form & running it from there. If not, you should because then you can
hide
the form, display the tray icon like you want. I have a few VB.NET
applications running on startup like you wish without problems doing it
the
sub main way
--
Newbie Coder
(It's just a name)
"Patrick Dugan" <pa***********@usnetNOSMORESPAMcomcorp.comwrote in
message
news:uX**************@TK2MSFTNGP03.phx.gbl...
>>I am using VS2005 (vb) and I have a program that starts when Windows
boots
up. Occasionally the icon that should appear in the system tray does
not
show up. The program is still running in memory but the tray icon is
not
there. If I start the program after Windows has booted up the icon
shows
every time. I am assuming that the reason is due to the icon being
created
>>before the system tray is loaded/running. I have used a timer with
"dim
notifyicon1 as new notifyicon" every few seconds and that works but I am
afraid I am eating up memory doing that or is that "ok" to do?
Is there any way to detect if the system tray is not running so I can
delay
>>the creation of the tray icon until it is?