how to kill process in Windows-CE?
Solution 1
First find the Process by giving the running exe's name and kill it. Use the System.Diagnostics namespace.
Process[] Prs = Process.GetProcessesById(RunninExe);
if (Prs.Length > 0)
{
foreach (Process Prss in Prs)
{
Prss.Kill();
}
}
Solution 2
The answer is that you have to use the toolhelp APIs. There's a full example on MSDN that includes enumerating processes and killing a selected one.
Solution 3
A code project does exactly what you are looking for. I found this class very usefull in Killing processes in CE.
http://www.codeproject.com/Articles/36841/Compact-Framework-Process-class-that-supports-full
ProcessInfo[] list = ProcessCE.GetProcesses();
foreach (ProcessInfo pinfo in list)
{
if (pinfo.FullPath.EndsWith("MyExe.exe"))
pinfo.Kill();
}
Solution 4
Once you have found your process you can call Kill
command.
it's in System.Diagnostics
and supported in .NET Compact Framework as well, see here:
Unfortunately it looks like Process.GetProcess does not work in the .NET CF so you should use another way to find your process before killing it, there are also articles about this:
Compact Framework Process class that supports fully specified file paths
Gali
Updated on June 04, 2022Comments
-
Gali almost 2 years
How can I kill process Windows\MyProcc.exe from my terminal (Windows-CE 5.0) using C# code?