View Full Version : multiple console windows

01-19-2002, 04:34 PM
is it possible to have more than one console window associated with a single console app? i'm working on map drawing algorithms and it'd help if i could see the raw data and an ASCII representation of the map side-by-side

01-20-2002, 01:48 PM
if you are talking windows ( and this is the dos board ) no. You can only have one console per process. Its in the msdn literature under console.

01-20-2002, 05:23 PM
The only way you can do this is make to seperate .exe's then open them up at the same time. DOS has no control over the windows.

02-13-2002, 11:05 PM
of course you can have multiple console. However each thread/process can only have one console attached to it. Therefore, you create a few threads for each of your drawing, and each of them can do

FreeConsole(); //this invalidates the previous console
AllocConsole(); //this creates new console and set to it and sets
//all the std handles
CreateFile("$CONOUT"...) //attach console output stream
CreateFile("$CONIN"....) //attaches the console input stream

when you create threads, use CreateThread() and set inherithandle to be false, and set the flag to be CREATE_NEW_CONSOLE, and you can do more fancy stuff with your configuration of the STARTINFO struct, just make sure you call FreeConsole() in your thread's destructor so that console gets collected. If your application needs to start within the service, make sure in your ServiceMain() you call AllocConsole because by default they get invalidated.