开发者

Calling windows form method from class file

开发者 https://www.devze.com 2023-02-15 09:30 出处:网络
I want to force closing a windows application by calling application.exit() on the class file开发者_如何转开发. But it only hide the application, the .exe still running on the task manager.

I want to force closing a windows application by calling application.exit() on the class file开发者_如何转开发. But it only hide the application, the .exe still running on the task manager.

I want to ask is there a way to fully terminate the windows application that can call on the class file? I can't call the windows form method from class file to perform this.close().


Application.Exit only closes the Winforms event loops, i.e. only the so called GUI thread is terminated.

You could call the Environment.Exit method to terminate the whole process. But if you have other threads running you should take care to terminate them properly, usually by sending them some message (but this depends entirely on your architecture).

0

精彩评论

暂无评论...
验证码 换一张
取 消