PDA

Click to See Complete Forum and Search --> : [RESOLVED] Process is running.


RoflJOE
Nov 26th, 2006, 11:17 AM
how do i check if a process is running, im making a program that starts "notepad" etc, if it aint allready open...

something like, if process("notepad") running then
----
else

run notepad

kinda thing ;)

Harsh Gupta
Nov 26th, 2006, 11:55 AM
The correct namespace is: System.Diagnostics.Process
private void IsNotePadRunning()
{
System.Diagnostics.Process[] pro = System.Diagnostics.Process.GetProcessesByName("notepad");
if (pro.GetLength(0) > 0)
{
//do your work here
}
else
{
System.Diagnostics.Process.Start("notepad.exe");
}
}

RoflJOE
Nov 26th, 2006, 12:00 PM
It works perfect thx dude