C#
C# -- main winform 닫을때, 다른 thread winform 도 동시 종료하기
자유프로그램
2019. 5. 25. 11:03
반응형
C# -- main winform 닫을때, 다른 thread winform 도 동시 종료하기
참고; https://stackoverflow.com/questions/5002279/killing-all-threads-that-opened-by-application
http://www.csharp411.com/close-all-forms-in-a-thread-safe-manner/
문제점 ;
메인 winform 이외에, 다른 thread winform 실행시에는, 메인 winform 닫아도 다른 winform 닫히지 안음.
해결책;
-- System.Diagnostics.Process.GetCurrentProcess().Kill(); 사용하자.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
// Application.Exit();
Process.GetCurrentProcess().Kill();
}
반응형