Starting Windows Application vs Console Application via Cmd
This information is stored as a part of the PEOptHeader
portion of the EXE binary format. Specifically the Subsystem
field tells the operating system what type of application this is and can have the following values
- 1: Native
- 2: Windows/GUI
- 3: Windows non-GUI
- 5: OS/2
- 7: POSIX
This is what tells windows what type of program it is and hence gives it the ability to make different choices as cmd does.
Technical details aside (JaredPar did a really good job of doing that), if you want to change your program from Windows/GUI
mode to Windows non-GUI
all you need to do is go in to your project settings and change the drop-down from "Windows Application" to "Console Application"
You can have a Window application run as a Console Application and it will give you the behavior you are expecting. (note however, now if you double click on the icon for the program it will open a console window that will stay open while your program is open.)