Dynamic GUI and console windows application

Running the same executable as a GUI as well as console application. This is one problem I had come across a few years back. But I soon realized that its decided while linking if an executable will be GUI or console application.

But given the amount of time its been I thought of searching online and I came across this article "How do I write a program that can be run either as a console or a GUI application?". It kinda had a solution but in the end its still better to have two separate executables. One for GUI apps and the other for console apps. After all these years Java also has two executables. java.exe for console apps and javaw.exe for GUI apps.

There are two bytes in the executable file which tell the OS if the file is Console or GUI app. Change those bytes and you can run it as a console or GUI application. For more information about the PE format visit http://wotsit.org.

Hopefully this is the first in the series and hopefully I will be writing more about it soon.

Comments

Popular posts from this blog

The best mobile development platform for hobbyist programmer

Using Voicemail with Airtel Prepaid Karnataka

Airtel 16Mbps for Impatient Ones