T
TomTom
My MainWinForm creates worker thread to do a long processing. Sometimes I
want to close the tool and click the Exit button (Application.Exit()) on
MainWinForm to kill it. However, the tool is still running in the
background, probably because of the worker thread and I have to the Task
Manager to kill the application.
I can work around this problem be using the code below, but I don't think
this is the recommended way. If you have a suggestion, can you let me know?
Process [] processes = Process.GetProcesses();
foreach(Process p in processes)
{
if(p.ProcessName==myProcessName) {
p.Kill();
}
}
Thanks,
TomTom
want to close the tool and click the Exit button (Application.Exit()) on
MainWinForm to kill it. However, the tool is still running in the
background, probably because of the worker thread and I have to the Task
Manager to kill the application.
I can work around this problem be using the code below, but I don't think
this is the recommended way. If you have a suggestion, can you let me know?
Process [] processes = Process.GetProcesses();
foreach(Process p in processes)
{
if(p.ProcessName==myProcessName) {
p.Kill();
}
}
Thanks,
TomTom