开发者

Finding out if the user manually closed the console window by clicking the red X in C#

开发者 https://www.devze.com 2023-01-18 04:46 出处:网络
I\'m working on a project that calls a console window to process some data based on passed in arguments. What I would like to know is how I can check to see if the user clicked on the red X within the

I'm working on a project that calls a console window to process some data based on passed in arguments. What I would like to know is how I can check to see if the user clicked on the red X within the console app.开发者_JAVA技巧 Is there an event I need to handle? Any advice would be greatly appreciated. This is being done using the .NET framework 3.5 using VS2005. Thanks.


Use SetConsoleCtrlHandler, C# example here.

0

精彩评论

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