: : : Hi,
: : : I am trying to make my life easier and write a generic error returning function.....so I dont have to rewrite modules depending on whether it will be a command line program or if its a GUI program (Yes I know command line programs can use ShowMessage...but thats not cool!)
: : :
: : : So heres the question
: : :
: : : How can I get a function to tell whether the program it is being run inside is a console application or a windowed program?
: : :
: : : Cheers,
: : : Johovishta
: : :
: : Here is a very crude method, but it works:
: :
: : try
: : writeln('This program is a console program');
: : except
: : ShowMessage('This program is a GUI program');
: : end;
: :
: : If you use writeln() with the Output file inside a GUI program, you will get a I/O 103 error.
: : A better alternative is to check if the Output file variable is created or not, but I don't know how to code that.
: :
:
: Thanks Zibidian...
: works fine but is a bit crude ..Oh well who will know but you and I :)
:
:
I have found a better way: the IsConsole global variable.