0

我使用 .net 创建了一个 Windows 应用程序。它工作正常。我的疑问是应用程序在后台运行,即使我关闭了应用程序。一旦关闭应用程序也在任务管理器应用程序中仍然运行。如何结束进程。给我你的建议。

4

3 回答 3

0

我猜您的应用程序中有一些称为“线程”

检查应用程序关闭时线程是否停止,如果没有,则在“表单关闭”事件中停止它们

如果可能,请发布您的一些代码

于 2013-10-16T06:13:37.593 回答
0

谢谢夏尔马,一旦我在关闭按钮中添加 Application.Exit(),问题就解决了。

于 2013-10-16T06:39:33.157 回答
0

I guess you created a thread and launched the Process from that thread. By default, a thread would be a Foreground thread. So, even if you close the MainWindow, the application would continue to run. On your main form close, do these 1) // Close process by sending a close message to its main window. myProcess.CloseMainWindow(); // Free resources associated with process. myProcess.Close(); Both the calls are required!! 2) Stop the thread

于 2013-10-16T06:23:57.807 回答