Thanks for the reply.

Guess I'm not very good at describing my problem...


If I do not use /t:winexe, a console window is _always_ created (if not
started from console). I don't want that.

I can be a mit more concrete:
I've written an application 'cm' that can have both a command line interface
and a GUI. I would like to start it in one of two ways:
a) cm /cmd <commands>
b) cm <whatever but not '/cmd'>

If started as in a) it should behave as a regular command line application -
inherit console window (redirection of stdin/stdout/stderr is sufficient) if
started from console window, create a new console window otherwise.

If started as in b), behave as a regular /t:winexe application with GUI.

Current last resort is to use /t:winexe and replace a) with: "cm /cmd <con
>con 2>con".(I will then not get a console when not started from command
line, but that is a minor issue.)


I can then use Console.In, Console.Out and Console.Err (which is all I want
to do if "/cmd" is specified)


Regard,
Rune Christennen


-----Original Message-----
From: Ian Griffiths [mailto:[EMAIL PROTECTED]]
Sent: 13. juni 2002 16:56
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Console window for Windows application


Have I missed something?  Isn't this what happens automatically when you
build a console application?  Or is there some nuance I've failed to spot?
(I've only had 1 coffee today...)

So if you want this behaviour for a Windows Forms application, just set the
output type to Console Application.  (There's nothing magic about the
/t:winexe switch - it just disables the behaviour your describe.  Console
applications are definitely allowed to open windows.)


--
Ian Griffiths
DevelopMentor

----- Original Message -----
From: "Rune Christensen 8397" <[EMAIL PROTECTED]>


> I'd like to implement the following algorithm for when a Windows
application
> wants console window / command line window access:
> 1. Was application started from a command line window?
>         Yes: select this window and goto 3.
> 2. Create a command line window and select this
> 3. Connect the In, Out and Error attributes of System.Console to selected
> window.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to