Problem A
I have an application that starts up a worker thread. I have code that properly kills that thread during normal shutdown, but if I'm debugging and stop the app, the thread keeps the app alive and I can't debug the app again without resetting teh device. What can the SDF do for me?
Problem B
I have a CE device that is running a process without a window (console or otherwise) and I'd like to kill it. What can the SDF do for me?
Solution
The solution to both is found in the OpenNETCF.ToolHelp.ProcessEntry class. Add this to an app and run it.
ProcessEntry[] currentProcesses = ProcessEntry.GetProcesses();
foreach (ProcessEntry p in currentProcesses)
{
if (p.ExeFile.ToLower() == "MyAppName.exe".ToLower())
{
p.Kill();
return;
}
}