开发者

Closing console closes GUI app too

I'm using C#/WPF, and generated a console programmatically using the WinAPI's Alloc/FreeConsole. When this is done, the standard System.Console class interacts wih it fine. Except, when you close the console by clicking the X rather than开发者_StackOverflow using FreeConsole(), it closes the rest of the app too. I'm using .NET 4- how can I override this behaviour?


This is just a guess, and it could be completely off, but does it have anything to do with Application.Current.ShutdownMode? Perhaps Application.Current.MainWindow is being set to the console, and ShutdownMode causes the application to terminate when the console window is closed?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜