Combined Console and Windows application please HELP

  • Thread starter Thread starter Mihai Marinescu
  • Start date Start date
M

Mihai Marinescu

Hi all,
I have a Windows Application which i want to make work as a Console
application if the exe file is getting arguments. How can i accomplish
this ?

Mihai
 
the same as console App
[STAThread]
static void Main(.....)
{
//receive argument
//
Application.Run(...);
}
 
Mihai said:
Hi all,
I have a Windows Application which i want to make work as a Console
application if the exe file is getting arguments. How can i accomplish
this ?

Mihai


Short answer: you can't.

If you set your project to console, you'll always get a console created
and attached to your process if you're not running from a console. If
you set your project to windows, then you can't get a handle to the
console that started you (you'll create a new one).

VS.NET IDE simulates what yoy want by having 2 programs: devenv.com and
devenv.exe. One's a consle app, one's a windows app.

Mark
 
Back
Top