Combination GUI / Console app?

BlitzMax Forums/MaxGUI Module/Combination GUI / Console app?

xlsior(Posted 2009) [#1]
From within the IDE you can to to enable GUI build or not.

What I'm wondering: Is it possible to create a program that's both ?

For example: If no parameters are detected simply launch the GUI version without a console window, but if certain command line parameters are passed print output to an existing console from where it was launched?

Enableing GUI build appears to disable any console output altogether, and disabling GUI build always launches a seperate console window even when nothing gets printed.

I guess it's possible to create two stand-alone programs and have the console version launch the GUI version as a seperate process if necessary, but if it's possible to merge the two that would be preferable.

(I have a conversion program that uses a GUI for more complicated tasks, but also want a command line mode for when you're just dealing with a single file)

Any thoughts?


SebHoll(Posted 2009) [#2]
I read a blog posting about this exact topic a few months ago.

The Old New Thing: How do I write a program that can be run either as a console or a GUI application?

You can't, but you can try to fake it.

He gives a link to a page explaining some of the techniques used to 'fake it'.

How to make an application as both GUI and Console application?

Not sure that this will be of much help...

Edit: AllocConsole() function, perhaps?


xlsior(Posted 2009) [#3]
OK... It does appear that the two-application approach is the best option.

Thanks for those links!