CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Q: How to display Console Window?

    Is there an easy way to display a console window and display status messages? Is there a better way to display a small window just for the sole purpose of displaying status messages? I do not want to embed a view, edit control, or anything like that. I am looking for a system call that can be embedded into the code.

    Thanks in advance


  2. #2
    Join Date
    Apr 1999
    Posts
    48

    Re: Q: How to display Console Window?

    If you have a Windows program but also want to send stuff to a Console window you can do:

    #include <fstream.h>

    AllocConsole();
    SetConsoleTitle(_T("My Status Output"));
    ofstream cstat("CONOUT$");
    cstat<< "hello" << endl <<flush;

    But it may not look aesthetic enough if you ship it to customers. If it's purely for your debugging you might be be better off looking at the TRACE macro or OutputDebugString function and make sure you have the output window turned on in Visual Studio when you run the program.


    Cheers,
    Roger




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