Thread: multiple console windows

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    48

    multiple console windows

    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
    astride a storied past, thats everywhere you are

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    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.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    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.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    7
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Top Level Windows
    By quark_77 in forum Windows Programming
    Replies: 0
    Last Post: 07-13-2008, 02:32 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Windows app without console
    By Zeike in forum Windows Programming
    Replies: 4
    Last Post: 08-31-2005, 12:59 PM
  4. #Develop Question, How do i create multiple Windows?
    By Zeusbwr in forum C# Programming
    Replies: 0
    Last Post: 04-24-2005, 11:14 AM
  5. Problem with windows console when running.
    By RealityFusion in forum C++ Programming
    Replies: 5
    Last Post: 08-07-2003, 08:56 PM