473,597 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easy way to tell if a program is running.

UJ
I am writing an automatic download process that will update software on a
computer. We've got services that run all of the time and a couple of
programs that run all of the time. How can I tell if the program/service is
running so I can stop it, update it and restart it?

TIA - Jeff.
Feb 7 '06 #1
2 1477
UJ,
I guess the easies way would be to try updting (replacing the files) if the
the program/service is running you will get an excpetion that the file you
are trying to replace is locked (used at the moment). Collect all such
failed updates and ask the user to stop problematic applications or if it is
possible stop them by yourself. You can also rename the files that has been
in use (you can do that even if the file is locked in the memory) and copy
the new ones. When the installation is done ask the user to restart the
machine. You need to have a mechanism to delete the old renamed files ones
the system is up and running again.

Other solution would be to use the Process class to check out all running
processes at the moment.
--

Stoitcho Goutsev (100)

"UJ" <fr**@nowhere.c om> wrote in message
news:O6******** *******@TK2MSFT NGP15.phx.gbl.. .
I am writing an automatic download process that will update software on a
computer. We've got services that run all of the time and a couple of
programs that run all of the time. How can I tell if the program/service is
running so I can stop it, update it and restart it?

TIA - Jeff.

Feb 7 '06 #2
Hi,

The services are easy to tell, all you have to do is use ServiceControll er
class to tell the status.

Regarding the running programs you could just follow Stoitcho's suggestion ,
or alternatively you could create a unique object in the system and check
for it (a common techinque to assure only one instance of an app is run)

Then you could send a message to the running process for it to terminate
gracefuly.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"UJ" <fr**@nowhere.c om> wrote in message
news:O6******** *******@TK2MSFT NGP15.phx.gbl.. .
I am writing an automatic download process that will update software on a
computer. We've got services that run all of the time and a couple of
programs that run all of the time. How can I tell if the program/service is
running so I can stop it, update it and restart it?

TIA - Jeff.

Feb 7 '06 #3

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

Similar topics

8
2741
by: Ang Talunin | last post by:
Hey, I want to write a program wich uses a database. But I don't want to set up a MySQL or other server (so I can easly install it on other computers). Is there a way to do it. Yes, please tell me how? No, what is the common used database for this kind of programs? thnx,
8
1778
by: Xero Limit 126 | last post by:
Okay, I am completely new to Python, and I really dont understand much, but I was wondering how to make a python script/program into a standalone .EXE? I dont understand py2exe at all, so if someone could tell me or find me an easy (For a newbie) to convert Python scripts to EXEs, please let me know! Thanks for any help!
9
3193
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
2
1345
by: Robert D. Young | last post by:
I've probably asked this before, but how can I tell within the program I'm running if the .py files was involved by "run module" in IDLE or by using the .py assoication with the python.exe program? I'd like to prevent running under certain circumstances, or pop-up warnings, or change character displays (some look different when run under IDLE). - Robert
12
7853
by: Robert Mark Bram | last post by:
Howdy All! Is there an easy way to find out the pixel height and width of an image? I want to write IMG tags in this form: <img src="../images/BigM_off.gif" width="173" height="169" name="BigM" alt="Logo Rollover!"> so I am looking for an app or windows thingy that can quickly tell me the height and width of an image. Thanks for any advice!
0
1383
by: Fiona McBride | last post by:
Hi all, I have a really odd problem with some Visual Basic .NET 2003 code; I have a program that creates a number of windows which contain RichTextBox, Timers (disabled) and menus. The code runs fine and creates the windows as required, BUT if the program is left to do nothing for several hours, when it is brought back into focus it generates an exception error (Object reference not set to instance of an object - this always coincides...
1
2609
by: Terry Olsen | last post by:
Is this the best way to see if a DOS executable is running? I tried getting process window titles but it takes longer and the window title could be any number of different names. I'm a little worried about my program corrupting the executable using the code below. Or should I not worry? The DOS app is operation critical. 'Make sure that PTE isn't running before we continue. Dim PTE As String = "d:\apps\pte\ptec.exe" Try Dim fi As...
16
2829
by: Michael | last post by:
Hi All, Why when I complile and run the following: #include "stdio.h" main(void) { printf("test test test\n"); }
4
1778
by: Rick Stevens | last post by:
I am not an access expert, could anyone tell me if the following would be easy to do?? I receive emails from a specific email address, that advise me if a specific piece of equipment my company maintains has failed. I also then get emails telling me when this equipment is back working again. All of this information is held within the body of the email. I would like to make this more graphical instead of filtering through
0
7894
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
8276
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...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8044
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
5847
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
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3893
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
3936
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.