简体   繁体   English

如何为Visual C ++控制台应用程序打开新的控制台窗口?

[英]How do I open a new console window for a Visual C++ console application?

What I want to do is something like this: 我想做的是这样的:

ConsoleWindow1.Print("1");
ConsoleWindow2.Print("2");

When I run the program, two console windows pop up and one gets printed with 1 and the other gets printed with 2. Is there a simple way of doing this? 当我运行该程序时,将弹出两个控制台窗口,其中一个窗口打印为1,另一个窗口打印为2。是否有一种简单的方法?

For console based application there can be only one console per process. 对于基于控制台的应用程序,每个进程只能有一个控制台。 You can start two processes and then do some sort of IPC to coordinate with each other 您可以启动两个过程,然后进行某种IPC协调

我看到的一种方法是,编写一个控制台,打印输出给exe的参数,并编写另一个使用不同参数调用这两个应用程序的程序,我没有尝试过,但是可能是您可以通过WIN32函数打开两个程序,请参见如何在Windows中打开控制台窗口。 Win32应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM