473,657 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 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
May 26 '06 #1
5 1805
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****@NOSPAMv anputer.com> escribió en el mensaje
news:44******** *************** @ptn-nntp-reader01.plus.n et...
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

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*****@NOSPAM sogecable.com> wrote in message
news:ur******** ******@TK2MSFTN GP05.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****@NOSPAMv anputer.com> escribió en el mensaje
news:44******** *************** @ptn-nntp-reader01.plus.n et...
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


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 ServiceControll er 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****@NOSPAMv anputer.com> escribió en el mensaje
news:44******** *************@p tn-nntp-reader01.plus.n et...
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*****@NOSPAM sogecable.com> wrote in message
news:u2******** ********@TK2MSF TNGP03.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 ServiceControll er 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****@NOSPAMv anputer.com> escribió en el mensaje
news:44******** *************@p tn-nntp-reader01.plus.n et...
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****@NOSPAMv anputer.com> escribió en el mensaje
news:44******** **************@ ptn-nntp-reader01.plus.n et...
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
3364
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 Gherman, Giorgio Giacomazzi, a promizing newcomer in the Python noosphere, and myself. We were discussing how to advertize for Python, and Dinu
1
3039
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
1296
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
4883
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
23068
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 to a pool. If I assign only one application to a applicaton pool and have multiple worker processes assigned to that pool. Will my application be processed by many worker processes?
4
7824
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 servers are in a stateless farm and have 2 GB of RAM. We are using ASP.NET 1.1 when using a dedicated application pool for each virtual directory. Each customer gets their own virtual directory and copy of the ASP.NET dll in their bin folder, which...
35
4011
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? I've been leaning towards threads, I'm going to say why. Processes seem fairly expensive from my research so far. Each fork copies the entire contents of memory into the new process. There's also a more expensive context switch between...
3
5859
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). The problem does not occur when performing the same bindings using a logon script. So, the user logs in, is able to perform queries all day, and then fails to log out at the end of the day. We'd prefer that they did log out nightly, but it...
1
3557
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 many of the others in the class. We haven't been exposed to any Unix and the professor hasn't, yet, said much more than the book, which is no help at this point. From what I've figured out and what I've blindly seen on the net and hoped would...
0
8395
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4155
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.