Process Name = ?

U

UJ

Is the name of process always the name of executable that is running? I'm
assuming a single process for a program. So in other words - if I want to
check if a program is running, can I do a
Process [] localByName = Process.GetProcessesByName( << Name of
executible without extension>> );

Will that work?

TIA - Jeff.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


UJ said:
Is the name of process always the name of executable that is running? I'm
assuming a single process for a program. So in other words - if I want to
check if a program is running, can I do a
Process [] localByName = Process.GetProcessesByName( << Name of
executible without extension>> );

Will that work?


IIRC there are ways to change the name of the process, not only that but you
could find at a later date that somebody else selected the same name for a
completely unrelated program.

Is the target program yours?

What are you tring to do?
 
U

UJ

The target program is something I've written. I'm trying to find out if the
program is running and if so, shut it down. This is part of an auto update
process where I'll download a new program and then shut the program down (if
it's currently running) and restart it.

J.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,


UJ said:
Is the name of process always the name of executable that is running? I'm
assuming a single process for a program. So in other words - if I want to
check if a program is running, can I do a
Process [] localByName = Process.GetProcessesByName( << Name of
executible without extension>> );

Will that work?


IIRC there are ways to change the name of the process, not only that but
you could find at a later date that somebody else selected the same name
for a completely unrelated program.

Is the target program yours?

What are you tring to do?
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


UJ said:
The target program is something I've written. I'm trying to find out if
the program is running and if so, shut it down. This is part of an auto
update process where I'll download a new program and then shut the program
down (if it's currently running) and restart it.

Then I suggest you to use something else, take a look at this
http://www.yoda.arachsys.com/csharp/faq/#one.application.instance you can
use something similar for your objective.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top