Possible Duplicate:
How do you kill a process for a particular user in .NET (C#)?
In my updater application i need to kill the main program before updating it.
Im using code to kill the process within the updater application, but it kills all processes with that name and therefore it kills the process for other users on the same machine. Is there some way to only kill the process for the current user?
This is my code so far:
foreach (System.Diagnostics.Process myProc in System.Diagnostics.Process.GetProcesses())
{
if (myProc.ProcessName == "ProgramName")
{
myProc.Kill();
}
}