|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Overnight processeshave 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 strHousekeepingFilename as String = "C:\Overnight.exe" Processes = System.Diagnostics.Process.GetProcessesByName("Overnight") If Processes.Length = 0 then Dim HKProcess as New System.Diagnostics.Process HKProcess.StartInfo.Filename = strHousekeepingFilename 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 Hi Andy,
I don´t know about the icon problem but processes like your program are better implemented as services, not requiring a user logged on, and the service can be configured to run on Windows startup. Once your program is a service, there are 3rd party monitoring tools used typically by the the people managing servers, etc. to monitor and restart Windows services (my company uses one of them). -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "Andy Baker" <abaker@NOSPAMvanputer.com> escribió en el mensaje news:4476e2b9$0$18254$ed2619ec@ptn-nntp-reader01.plus.net... > 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 strHousekeepingFilename as String = "C:\Overnight.exe" > Processes = System.Diagnostics.Process.GetProcessesByName("Overnight") > If Processes.Length = 0 then > Dim HKProcess as New System.Diagnostics.Process > HKProcess.StartInfo.Filename = strHousekeepingFilename > 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 > > Hi Carlos
Thanks for the quick reply. I thought of implementing the whole thing as a service, but it requires a user interface of sorts, so the user can choose which options to run overnight, and also to be able to force the routine during the day in case it has not run overnight for some reason. Is there a way of adding a form to a service? Andy Baker Show quoteHide quote "Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> wrote in message news:urqgQcLgGHA.3364@TK2MSFTNGP05.phx.gbl... > Hi Andy, > > I don´t know about the icon problem but processes like your program are > better implemented as services, not requiring a user logged on, and the > service can be configured to run on Windows startup. Once your program is > a service, there are 3rd party monitoring tools used typically by the the > people managing servers, etc. to monitor and restart Windows services (my > company uses one of them). > > -- > > Best regards, > > Carlos J. Quintero > > MZ-Tools: Productivity add-ins for Visual Studio > You can code, design and document much faster: > http://www.mztools.com > > > > "Andy Baker" <abaker@NOSPAMvanputer.com> escribió en el mensaje > news:4476e2b9$0$18254$ed2619ec@ptn-nntp-reader01.plus.net... >> 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 strHousekeepingFilename as String = "C:\Overnight.exe" >> Processes = System.Diagnostics.Process.GetProcessesByName("Overnight") >> If Processes.Length = 0 then >> Dim HKProcess as New System.Diagnostics.Process >> HKProcess.StartInfo.Filename = strHousekeepingFilename >> 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 >> >> > > Hi Andy,
Yes: - Services can have too an user interface in the notifications area, such as SQL Server or most antivirus. - Or you can even create an standalone executable to configure your service that can set options, start or shutdown it, etc . See the MSDN docs about the ServiceController class: http://msdn2.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "Andy Baker" <abaker@NOSPAMvanputer.com> escribió en el mensaje news:447726e3$0$574$ed2619ec@ptn-nntp-reader01.plus.net... > Hi Carlos > > Thanks for the quick reply. I thought of implementing the whole thing as a > service, but it requires a user interface of sorts, so the user can choose > which options to run overnight, and also to be able to force the routine > during the day in case it has not run overnight for some reason. Is there > a way of adding a form to a service? > > Andy Baker Hi Carlos
Thanks for that. I think that I'll get the routines working in the executable that I have at the moment, and then put the whole thing in the service. To add the user interface to the service project, is it as simple as adding a form and setting the startup object for the project? Andy Baker Show quoteHide quote "Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> wrote in message news:u2%23o6vvgGHA.1276@TK2MSFTNGP03.phx.gbl... > Hi Andy, > > Yes: > > - Services can have too an user interface in the notifications area, such > as SQL Server or most antivirus. > > - Or you can even create an standalone executable to configure your > service that can set options, start or shutdown it, etc . See the MSDN > docs about the ServiceController class: > http://msdn2.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx > > -- > > Best regards, > > Carlos J. Quintero > > MZ-Tools: Productivity add-ins for Visual Studio > You can code, design and document much faster: > http://www.mztools.com > > > > > "Andy Baker" <abaker@NOSPAMvanputer.com> escribió en el mensaje > news:447726e3$0$574$ed2619ec@ptn-nntp-reader01.plus.net... >> Hi Carlos >> >> Thanks for the quick reply. I thought of implementing the whole thing as >> a service, but it requires a user interface of sorts, so the user can >> choose which options to run overnight, and also to be able to force the >> routine during the day in case it has not run overnight for some reason. >> Is there a way of adding a form to a service? >> >> Andy Baker > > Hi Andy,
See these threads: http://groups.google.es/groups/search?hl=es&q=microsoft.public.dotnet+service+icon -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "Andy Baker" <abaker@NOSPAMvanputer.com> escribió en el mensaje news:447c0040$0$2684$ed2619ec@ptn-nntp-reader01.plus.net... > Hi Carlos > > Thanks for that. I think that I'll get the routines working in the > executable that I have at the moment, and then put the whole thing in the > service. To add the user interface to the service project, is it as simple > as adding a form and setting the startup object for the project? > > Andy Baker >
converting the use of interfaces under vb6 to vb.net
WebBrowser Control Frame Documents How to translate C++ 'for' loop into VB.NET? ClickOnce deployment problem! Closing another application Text color list box Stupid Question of the day...... opening a document with system's default app sql server 2005 Button Image |
|||||||||||||||||||||||