Multiple consoles for a single C ++ application

Is it possible to create two console windows (one of which is the main one), and the second one with a pop-up window, like a message window in Windows Forms?

I want the identifiers (which will be hardcoded in the application) to be saved in the secondary console window. Thus, the user does not need to return to the main menu to check the available identifiers

If so, how would you do it?

Many thanks

+8
c ++ windows windows-console console-application
source share
2 answers

Yes you can do it.

The solution is actually very simple - our process can start a new child helper process, so the auxiliary process will display everything that our process sends. We can easily implement such a solution using pipes: for each new console (which I will call logger) we will open the channel and execute the Console-Helper application - the role of this application is very simple, it will print everything that is sent through the pipe. Check out this article Multiple consoles for a single application for detailed information (contains source code).

In the code, it implements the CConsoleLogger console CConsoleLogger , then you can create several console windows, for example:

 CConsoleLogger another_console; another_console.Create("This is the first console"); another_console.printf("WOW !!! COOLL !!! another console ???"); 

And you will get something like:

enter image description here

+13
source share

See the http://msdn.microsoft.com/en-us/library/windows/desktop/ms682528(v=vs.85).aspx instructions for creating a console window.

+1
source share

All Articles