I think the typical way to do this is with staged executables.

devenv (the command line utility for the Visual Studio IDE) is actually two 
executables. When you type devenv on the command line, you're actually 
running the command line version, which will spawn the true Windows app as 
necessary. To do this, there's two executables:
devenv.com<http://devenv.com>and
devenv.exe. From a command prompt, the .com file has precedence (it's really 
just a renamed .exe; it doesn't have to be a .com file). When run from the 
shell (i.e., start/run), the .exe file has precendence.

I think you'll end up having to do the same thing.

On 7/25/05, Kamen Lilov <[EMAIL PROTECTED]> wrote:
> 
> I have a WinForms app. When started directly (without cmd line 
> parameters),
> I want it to be a regular application - it displays a main form and works 
> as
> expected.
> 
> When invoked with certain parameters, however, I want it to be treated as 
> a
> Win32 console app. I want to be able to do Console.Write and emit the
> output in the command session where the app was started. I know I can
> PInvoke and call AllocConsole but this is _not_ what my intention is. The
> console of my caller (e.g. the cmd.exe prompt) should be the one that gets
> my output, and I want the application to execute fully before control is
> returned to the console - or to the next app in a batch file.
> 
> How do I approach this?
> 

-- 
Brad Wilson
http://www.dotnetdevs.com/
http://www.agileprogrammer.com/dotnetguy/

Peter: "Oh my god, Brian, there's a message in my Alphabits. It says, 
'Oooooo.' "
Brian: "Peter, those are Cheerios."
- Family Guy

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to