I am writing a standard windows app in Delphi 7.
If I was writing a console app, I can call the following to output to the cmd line or output file.
write
There's no reliable way for a GUI subsystem application to attach to the console of its parent process. If you try to do so you end up with two active processes sharing the same console. This leads to no end of trouble.
The alternative, whilst retaining just a single executable, as suggested by bummi, is to have a console app that frees its console if it is asked to run in GUI mode. This is a better approach, but leads to a console window flashing up, and then closing, when you want to run in GUI mode.
The best discussion of the subject that I have come across on Stack Overflow is Rob Kennedy's superb answer: Can one executable be both a console and GUI application?
I believe, from what you say in comments, that the best option for you is to create two separate executables. One for the GUI subsystem, and one for the console subsystem. This is the approach taken by:
Yes you have to ship multiple executables. But doing so gives the user the best experience.