An easy way to accomplish this is to start with a console application.
Inside Main, create an instance of a class derived from
System.Windows.Forms.Form. You now have two options:
1. You can start your form object as a windows app by calling
Application.Run(<instance of your form class>)
2. You can choose not to display the GUI and simply use the public members
of your form object directly.
Typically, whether you display the GUI depends on the parameters passed on
the command line. You also have access to the console through the underlying
console app. You can easily utilize a callback delegate to have the windows
application pass information to the console app and write this to the
console window.
I hope this helps.
--
Kai Brinkmann [MSFT]
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"lavu" <th******@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I currently have a C# windows Application . I would like this App to
work through an command line interface also. I would like to specify
command line params, which should start the app and process using the
params.
However as a starting step I am trying to print the command line args
to the console ( form the windows application) and that is not
working.
1.Is it possible to print to the console in a windows application ? If
so how would I do this.
2. Is it possible to suppress the GUI (form) of a c# windows
application and allow the processing to occur as though it is a console
app ?
Thanks in advance.