Re: Console window opening during system() call inside GTK User Interface



However, windows (for historical reasons) has both
IMAGE_SUBSYSTEM_WINDOWS_GUI and IMAGE_SUBSYSTEM_WINDOWS_CUI
executables (possible values for the "executable type" field in the
.exe).

It is possible to change the value of this field in the .exe header.
Depending on the case, this might be something worth doing. If you
have the Microsoft compiler and tool set, use editbin.exe. Otherwise,
just google for some tool to do it, I'm sure there must be a free one
out there, as it really is just a question of changing one byte in a
fully documented header of the .exe file. (Of course, use common sense
as usual and watch out for malware. Preferably look for the sources to
such a tool, shouldn't be more than some dozens of lines.)

(As an experiment, make a copy of for instance "notepad.exe" (a copy
so that the automatic system file protection features of XP won't
immediately restore the original) and change it to a console
executable. Compare its behaviour to the original notepad. Then make a
copy of for instance netstat.exe and make it into a GUI executable.
Compare its behaviour to the original netstat.exe, especially paying
attention to where its output goes when you start it just by typing
its path name in cmd.exe, compared to if you redirect its output with
a pipe or ">". This experimentation will for instance show you that
the value of the "console" or "GUI" field in the header has no impact
on whether the executable in question can have a GUI or not. The names
are just historical artifacts.)

--tml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]