473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to let GUI application write output to commandline?

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
Nov 20 '05 #1
1 1591
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
"Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> wrote in message
news:ex****************@tk2msftngp13.phx.gbl...
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

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gernot Hillier | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I'm the developer of a Linux ISDN application which uses embedded Python for controlling the communication. It starts several threads (i.e....
17
by: David Hughes | last post by:
For example, in Python in a Nutshell, Alex Martelli shows how you can run a Windows (notepad.exe) or Unix-like (/bin/vim) text editor using os.spawnv(os.P_WAIT, editor, ) But how would you call...
6
by: R. Stormo | last post by:
I have a problem showing output that is comming from a script. If I make a script running at commandline it do work and everything are showing. But when I try to execute it from within my proggy...
5
by: Robin Johnson | last post by:
Hi, I've written an engine in Javascript for running text adventure games on a web page: http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the only game I've written with it so...
2
by: Steve | last post by:
I have created a console app that simply prints out a message a couple times, then exits, here is the code: <code> for(int i = 0; i < 10; i++) { System.Threading.Thread.Sleep(500);...
2
by: Mesan | last post by:
Hello everyone, Thanks to many useful posts in this newsgroup and others, I've been able to come very close to something I've been wanting to do for a very long time. I've figured out how to...
25
by: mereba | last post by:
Hello My country Ghana is changing its currency. I want to write a small programme in C++ that can covert from the old currency into the new one. I would like this programme to run behind a simple...
4
by: sdanda | last post by:
Hi, I am working on C# windows applications.What i want to do is, I want to Redirect the output from Command Prompt to the Rich Text Box, Actually i am unable to read the entire output of the comman...
4
by: George Oliver | last post by:
hi, I'm a novice programmer trying to better define a hobby project I'm thinking of. What I would like to do is take a program and embed it or put it within a Python-run GUI, using the GUI just...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.