com version is built as a Console application while the. The second hack commonly used is to create two separate binaries, for example, a and myuselessprogram.exe. The downside of this approach is it flashes a Console window on the screen when run as a GUI application that looks pretty unprofessional. One solution proposed was to compile the program as a Windows application and then edit the PE header to mark the program as using the Console subsystem. People have attempted various hacks over the years to solve this problem. If the program is built as a GUI application then the application detaches from the parent console and all output to stdout and stderr are are lost – basically the program runs, but doesn’t output anything to the parent console window. If the application is built using SUBSYSTEM/Console then the kernel will connect the application to the parent console and the application’s stdout, stderr and stdin will be redirected to the parent console. The subsystem is used by the Windows kernel to set up the execution environment for the application. This is set in Visual Studio by using one of the linker SUBSYSTEM option (i.e. Unfortunately the way Windows work, each exe application has field in the PE header that specifies which subsystem it should run under. act as a GUI application if double clicked in Windows Explorer or as a console application if called from a cmd.exe window). It would be very nice to be able to make Windows applications that can act as either a GUI or console application depending on how they are used (i.e.
0 Comments
Leave a Reply. |