Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

C++ Win32: spawning a second console window

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Mantear   Members   

251
Like
0Likes
Like

Posted 05 December 2008 - 05:09 AM

Greetings! I have a Win32 console application under VS2008 in C++. I have two threads running. One thread prints the status of the program, the other prints a series of menus and lets the user enter in menu selections. I would like to spawn a second console window so I can seperate the printing of the two threads. I don't know enough Win32 to even know what to google for, so a point in the right direction would be greatly appreciated. Thanks!

#2 SiCrane   Moderators   

11763
Like
0Likes
Like

Posted 05 December 2008 - 05:17 AM

The short answer is that you can't: only a single console can be attached to any given process.

The long answer is that you can fake it by spawning one or more additional processes and feeding data to those processes. One way to do that is to use CreateProcess() to create a single additional process and redirect pipes to child process see this article for information on how to do that. Alternately, you can create two extra console processes and use AttachConsole() and FreeConsole() to connect to and detach from the child processes.

#3 Mantear   Members   

251
Like
0Likes
Like

Posted 05 December 2008 - 06:52 AM

After searching around for a while looking at CreateProcess() and AttachConsole(), I don't think this is the direction I want to take. I'm guessing it's going to be a lot easier to create a simple dialog box with a text box from the consol app then try to get two consoles on the screen.

#4 LessBread   Members   

1415
Like
0Likes
Like

Posted 05 December 2008 - 08:28 AM

Wouldn't it be easier to simply label the output from either thread with an identifier? Like this:

T1: ...output...
T1: ...output...
T1: ...output...
T2: ...output...
T1: ...output...
T2: ...output...
...






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.