Open a new console with every new Thread in C#?

时光怂恿深爱的人放手 提交于 2019-11-27 07:44:49

问题


I want to have a new console open whenever I create a new thread so that the output will be organized. My application is fully console based. Would this be possible if so how?

Regards!


回答1:


A process can be associated with only one console

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681944(v=vs.85).aspx




回答2:


It's not difficult to work around this limitation.

The code that you want to run as a separate thread with its own console window, simply code that as a separate console application, passing parameters as required on the command line.

Then run separate instances of this code using Start() inside your main application.



来源:https://stackoverflow.com/questions/8023796/open-a-new-console-with-every-new-thread-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!