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 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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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
|
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
|
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;
|
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...
|
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...
|
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? ...
|
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). ...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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
|
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...
| |