Thread: How to...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    33

    How to...

    I was wandering how to code to open up a new window or console while already programming in console. In other words... After the code is run, make it open up the main console window, and then other windows after it and have specific code run in each separate window...

    Could anyone help me on achieving this?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Simple answer is that you can't. If you are using console applications, you can only have one window - there is a function to create a console window, AllocConsole(), but the description of it says:
    Quote Originally Posted by Microsoft
    A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console. A process can use the FreeConsole function to detach itself from its current console, and then it can call AllocConsole to create a new console or AttachConsole to attach to another console. If the calling process creates a child process, the child inherits the new console.
    You have to use the Windows application mode if you want to use multiple windows with one application.

    --
    Mats

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    You could spawn a child process with inherited STDOUT, STDERR and STDIN streams (over a pipe).

    Or, simply communicate over pipes, process to process, rather than having inherited handles.

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    33
    hmmm... ok, how would i do it with application mode to create multiple windows?

Popular pages Recent additions subscribe to a feed