Im looking for a way to kill a process by name using C# on WindowsCE
The .NET Compact Framework doesnt have a Process.GetProcessByName() method it only has a .GetProcessById() method.
But i dont know how i can figure out the process id of my running process.
I was thinking i could loop though all the process ids, but this is horrible because i dont know the max number of process ids. Anyone know a better way?
for (int i = 1; i < 40000; i++)
{
Process prs = Process.GetProcessById(i);
if (prs.StartInfo.FileName == "MyExe.exe")
{
prs.Kill();
}
prs.Dispose();
}
EDIT: I found the solution to my problem. A codeproject link. http://www.codeproject.com/Articles/36841/Compact-Framework-Process-class-that-supports-full