Yes, I want to write to the console where the user typed the
application name and parameters.
It doesn't show the usage lines.
I've found some more info about this, and nobody seems to have a
solution.
One solution implies changing the aplication to a console application,
and releasing the console if it should be run in GUI mode, which will
flash a black window. Another implies creating two applications with
the same name, but one with .EXE and one with .COM extensions. Both are
very bad...
It's hard to accept that "computers can't do this", isn't it? It's
something so simple.
Maybe it's a question of getting the handlers for STDIN and STDOUT and
passing them to Console.In and Console.Out?...
Eduardo
sd********@gmail.com wrote:
Why would he need to use AllocConsole? He wants to write to the console
from which his application was invoked
Michael Nemtsev wrote: Hello ed********@gmail.com,
You need to use API function AllocConsole
See samlpe of usin it in C# there http://groups.google.com/group/micro...2ca7a3ebfde2df
I have a GUI application that needs to be invoked from the command
line as well. It should work both as a GUI and as a console
application.
When I invoke it from the command line, it reads all the command line
options perfectly. However, I can't use Console.WriteLine to write
messages to the console (the lines don't appear at the console
window).
Is it possible? What should I do to "connect" the console?
My Main() is:
static void Main(string[] args)
{
if (args.Length == 0)
{
Application.Run(new WorkspaceForm());
return;
}
if (args.Length == 2 && args[0].ToLower() == "-mycommand")
{
DoMyCommand(args[1]);
return;
}
Console.WriteLine("Usage:\n\napplication_name -mycommand
<file>\n");
Console.WriteLine(" Performs mycommand on file.\n");
}
Thanks
Eduardo
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche