473,582 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.writeli ne the output doesn't appear at the commandline
prompt though.
I guess this is because the default output for the Console.Writeli ne 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 1607
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
GetConsoleWindo w. 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@{Do esNotLikeSpam}v laamsparlement. be> wrote in message
news:ex******** ********@tk2msf tngp13.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.writeli ne the output doesn't appear at the commandline
prompt though.
I guess this is because the default output for the Console.Writeli ne 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
5832
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. one for each incoming call and for outgoing faxes) which run Python scripts in embedded Python interpreters which in turn do the real...
17
7436
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 the OS X text editor /Applications/TextEdit.app - which appears to be a whole directory inside /Applications? I'm sorry if the answer is blindingly...
6
2000
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 it would not show. I have tried to save the outout to a file and again, when I runit from commandline it do save everything but from software it...
5
5606
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 far, and a version of the engine that is slightly less sophisticated than my development copy, which has cleaner code and a more authentic...
2
4742
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); Console.WriteLine(String.Format("Sleeping...{0}", i)); } Console.WriteLine("Done!"); </code>
2
5492
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 create a new custom protocol handler in Windows to handle locations like "myProtocol:", which lets me have a shortcut pointing to...
25
5913
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 calculator- looking interface. I'm quite new to C++, and I would need some help. Please any suggestion is welcome :) The following is what I...
4
1994
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 prompt, but i can see only the few lines.I don't know what's the wrong in my code.Here is the sample code. ChildLaunch() { Process p =...
4
1668
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 to capture and send input to the application, and display the ouput. Specifically I want to use a Python module such as wxPython, pygame or...
0
8312
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8183
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6569
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.