473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Overnight processes

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("Ove rnight")
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
May 26 '06 #1
5 1794
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" <ab****@NOSPAMvanputer.com> escribió en el mensaje
news:44***********************@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("Ove rnight")
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

May 26 '06 #2
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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in message
news:ur**************@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" <ab****@NOSPAMvanputer.com> escribió en el mensaje
news:44***********************@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("Ove rnight")
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


May 26 '06 #3
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/lib...ontroller.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" <ab****@NOSPAMvanputer.com> escribió en el mensaje
news:44*********************@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

May 29 '06 #4
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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in message
news:u2****************@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/lib...ontroller.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" <ab****@NOSPAMvanputer.com> escribió en el mensaje
news:44*********************@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


May 30 '06 #5
Hi Andy,

See these threads:
http://groups.google.es/groups/searc...t+service+icon

--

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" <ab****@NOSPAMvanputer.com> escribió en el mensaje
news:44**********************@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


May 30 '06 #6

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

Similar topics

15
by: Christian Tismer | last post by:
Dear friends. During a conversation with good friends and newly acquired Pythonista, we were discussing Python, what it is in essence, and what it is giving to us. The people were Dinu...
1
by: Markus Franz | last post by:
Hi. I created a little script: for currenturl in sys.argv: pid = os.fork() if pid == 0: signal.alarm(10) do_something() # placeholder for the download and print routine
0
by: Chen, Mao | last post by:
------_=_NextPart_001_01C35C45.723AEBCE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 Hi everyone, =20
15
by: Dirk Reske | last post by:
Hello, why doesn't this code work correctly? private int GetCpuUsage(Process proc) { DateTime time1,time2; TimeSpan timediff; double cpu1,cpu2,cpudiff;
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
4
by: AN | last post by:
Greetings, We make an ASP.NET web application and we host it for our customers. We have provisioned hardware and hope to be able to service around 200 customers on this hardware. The web...
35
by: Carl J. Van Arsdall | last post by:
Alright, based a on discussion on this mailing list, I've started to wonder, why use threads vs processes. So, If I have a system that has a large area of shared memory, which would be better? ...
3
by: aydeejay | last post by:
I'm trying to troubleshoot an issue where users are not able to bind with LDAP via "GetObject" through our ASP Classic Intranet if they stay logged in overnight (beyond their allowed login hours). ...
1
by: jazon | last post by:
Let me start by saying this for an Operating Systems class. No, I don't expect the work to be done for me. The assignment is as follows: To be honest, I feel like a fish out of water, like...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.