How to let GUI application write output to commandline?
(Tuesday, December 21, 2004)
Found the following interesting discussion in the Newsgroups:
How to let GUI application write output to commandline? by:Rvo
| I'm writing an application that should work both as a GUI and a commandline program. When running from commandline I want to give all output to the commandline instead of showing it it an own interface. When I use Console.writeline the output doesn't appear at the commandline prompt though. I guess this is because the default output for the Console.Writeline is set to the (invisible) gui at that time.
Is there a way to avoid/change this behaviour?
Thanks for your time...
Romain
| | | Reply: by:AlexS
| | | Hi, Rvo
You have to detect if program is started in GUI or console mode and act accordingly. If you want to duplicate output to console always, you might want to consider - creating your application as console one - attach console to process otherwise using Win32 APIs like AttachConsole or GetConsoleWindow. Depends how exactly you need console to behave
You might want to check Platform SDK help - Console Functions - to find more details.
HTH Alex
|

|
0 Comments:
Post a Comment
<< Home