0

I am working on an existing C++/MFC Windows program, and I would like to get the console for text output. I found no option for that.

Can I set an option to get a console window from a C++/MFC program without redoing the project from scratch?

Can I avoid using the AllocConsole() function call, and just set the project options?

In case I must use AllocConsole(), where can I call it? I have no main() function in the program, so I do not know which is the entry point.

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • If this is just for debugging, MFC programs do this using the TRACE macro. It sends to the output window in Visual C++. – ScottMcP-MVP Aug 21 '14 at 20:16

1 Answers1

1

You must use AllocConsole - either a windows program is console, or it's not. You can do so e.g. in CWinApp::InitInstance, since WinMain is abstracted away for you by MFC. But you can do it from anywhere really.

Roel
  • 19,338
  • 6
  • 61
  • 90