How to Open Console Window in a Win32 Application

When you create a basic main()-based application, you get the console window implicitly; but a typical WinMain()-based application does not open a console window – you have to allocate the console and to connect the I/O streams yourself.

Yet, this is not a thing you find described in manuals. Fortunately, it’s simple to do, and the code presented here can be used as-is in all your projects.
Continue reading