how to finde out in C# that a prossess "exe" is allready runningor not ?

  • Thread starter Thread starter Saleh Matani
  • Start date Start date
S

Saleh Matani

how to finde out in C# that a prossess "exe" is allready running or not ?
and how to make programm wait 1 sec between checks?

thank you

Saleh Matani
 
sorry didn t completely answer your question

i used FindWindow api calls for my last app, it wored well.

I would use a timer with interval of 1000 and on timer tick event call the
findwindow api.
 
Saleh Matani said:
how to finde out in C# that a prossess "exe" is allready running or not ?
and how to make programm wait 1 sec between checks?

thank you

Saleh Matani

To find an instance of a running process, you can use the static
"GetProcessesByName" method of the Process class.
You can set-up a timer using the various Timer classes in the framework,
check System.Timers, System.Threading.Timers or the
System.Windows.Forms.Timer classes.
Question is, why exactly do you need to know if an exe is already running?

Willy.
 
try the following line of code worked for me

Process[] arrProcess;
arrProcess=Process.GetProcesses(/* Conputer Name*/);

foreach (Process p in arrProcess)
{
if (p.ProcessName=="/*prossess "exe" name*/ ")
{
// Log the Event, here u can get when the process
is started or closed
}
}
 
thank you :)

milk-jam said:
try the following line of code worked for me

Process[] arrProcess;
arrProcess=Process.GetProcesses(/* Conputer Name*/);

foreach (Process p in arrProcess)
{
if (p.ProcessName=="/*prossess "exe" name*/ ")
{
// Log the Event, here u can get when the process
is started or closed
}
}

how to finde out in C# that a prossess "exe" is allready running or not ?
and how to make programm wait 1 sec between checks?

thank you

Saleh Matani
 
Back
Top