473,467 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

System tray icon does not always show when starting app when Windows starts

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?
May 1 '07 #1
3 7902
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?


May 2 '07 #2

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?



May 2 '07 #3
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?




May 5 '07 #4

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

Similar topics

5
by: Robert Smith | last post by:
Hello, I have often seen system tray icons that you click on and a popup menu appears. Is it possible to do this in Visual basic.net or are there any controls that allow this to be achieved. ...
1
by: John Veldthuis | last post by:
What sizes can the system tray icons be? I have a utility that I display a number as an icon. I do it by using drawstring into the icon bitmap and displaying it. It is fine as long as the number...
6
by: Amongin Ewinyu | last post by:
Hi, I have an application that is controlled by a service. when the service starts, an icon is supposed to be placed in the system tray and this icon is then used to display a balloon...
7
by: 3c273 | last post by:
Hello, I have a short looping script that runs in the background (Windows 2000) and I want to have a tray icon so I know that it is running. I have looked at wxTaskBarIcon and the examples on the...
2
by: asif | last post by:
When I add a USB key, system tray icon on Windows XP shows USB icon. It also shows icon that can be used to "Safely Remove Hardware". I would like to use this icon in one of my Visual C++...
1
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
2
by: mfunkmann | last post by:
Hi there! I have a problem here: I am using System.Data.Column and the Designer wrote follwing Code for me: this.System = new System.Data.DataColumn(); So far great, but furthermore I was...
2
by: swas | last post by:
Hi, I want to have a system tray icon for a small app, as well as have the option to auto load app on system startup. Something similar to the SQL Server Manager. I am reasonably comfortable with...
4
by: ewokspy | last post by:
I have a system tray icon with a context menu set to appear on right-click. On a right click the menu appears fine and I can select an option. The problem is that the event doesn't fire immediately....
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.