CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    1

    Window and AllocConsole

    I am currently writing an application that opens a debug window during the runtime. With the application, then window would be opened using the command AllocConsole. The only issue is if the user closes the debug window, the entire application closes. Is there any way I can create a console that will not cause the Win32 API window to close?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Window and AllocConsole

    Quote Originally Posted by iWizardPro View Post
    Is there any way I can create a console that will not cause the Win32 API window to close?
    Not that I'm aware of.

  3. #3
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Window and AllocConsole

    Quote Originally Posted by iWizardPro View Post
    Is there any way I can create a console that will not cause the Win32 API window to close?
    You need to open it in a separate process. Use CreateProcess for that.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Window and AllocConsole

    Quote Originally Posted by ahmd View Post
    You need to open it in a separate process. Use CreateProcess for that.
    How would this work for what the OP is trying to do?

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Window and AllocConsole

    Quote Originally Posted by Arjay View Post
    How would this work for what the OP is trying to do?
    The OP writes the code that is output into the console window in a separate console project and starts it using CreateProcess. He/she may use Interprocess Communication or a simple command line parameters call to convey the information into this console application.

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Window and AllocConsole

    Quote Originally Posted by ahmd View Post
    The OP writes the code that is output into the console window in a separate console project and starts it using CreateProcess. He/she may use Interprocess Communication or a simple command line parameters call to convey the information into this console application.
    Thanks for the clarification. The original response implied that CreateProcess could be used as a direct replacement for AllocConsole as opposed to having to create a separate application using interprocess communication.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured