Our VB.NET 2003 application requires several processes to run overnight. I
have written a program to perform these processes with a simple user
interface to allow the user to switch various options on/off, and using the
code from VB.NET programmer's cookbook (NotifyIcon) have it running in the
system tray. When windows xp is started, the overnight routines program
starts, and the icon appears in the system tray. I then use a timer to
perform the routines at the appropriate time.
It is important that this program is always running, so I need a way of
constantly monitoring the running processes, and if the overnight program is
not running, restart it. I have created a windows service that starts when
windows starts, and whose sole purpose is to check at various intervals to
see if the program is running. This works successfully except for the fact
that when the service restarts the application, the icon doesn't appear in
the system tray, although it is running. The code in the service is
Dim strHousekeeping Filename as String = "C:\Overnight.e xe"
Processes = System.Diagnost ics.Process.Get ProcessesByName ("Overnight" )
If Processes.Lengt h = 0 then
Dim HKProcess as New System.Diagnost ics.Process
HKProcess.Start Info.Filename = strHousekeeping Filename
HKProcess.Start
End if
How can I get the icon to appear in the system tray, or is there a better
way of ensuring that the program is always running? Thanks in advance.
Andy Baker
have written a program to perform these processes with a simple user
interface to allow the user to switch various options on/off, and using the
code from VB.NET programmer's cookbook (NotifyIcon) have it running in the
system tray. When windows xp is started, the overnight routines program
starts, and the icon appears in the system tray. I then use a timer to
perform the routines at the appropriate time.
It is important that this program is always running, so I need a way of
constantly monitoring the running processes, and if the overnight program is
not running, restart it. I have created a windows service that starts when
windows starts, and whose sole purpose is to check at various intervals to
see if the program is running. This works successfully except for the fact
that when the service restarts the application, the icon doesn't appear in
the system tray, although it is running. The code in the service is
Dim strHousekeeping Filename as String = "C:\Overnight.e xe"
Processes = System.Diagnost ics.Process.Get ProcessesByName ("Overnight" )
If Processes.Lengt h = 0 then
Dim HKProcess as New System.Diagnost ics.Process
HKProcess.Start Info.Filename = strHousekeeping Filename
HKProcess.Start
End if
How can I get the icon to appear in the system tray, or is there a better
way of ensuring that the program is always running? Thanks in advance.
Andy Baker
Comment