HighTechTalks DotNet Forums  

How to: Launch A Console Appplication in Hidden Mode?

Dotnet Framework microsoft.public.dotnet.framework


Discuss How to: Launch A Console Appplication in Hidden Mode? in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ESmith
 
Posts: n/a

Default How to: Launch A Console Appplication in Hidden Mode? - 06-22-2006 , 09:17 AM






I want to create a small console application that essentially gets some
information and then launches a Windows Application. What I want to do is
have the console application launched in hidden mode - I know how to do this
from with a Windows Application by creating a Process and using StartInfo,
but how can I configure a console application to run in hidden mode from
startup?

TIA



Reply With Quote
  #2  
Old   
r norman
 
Posts: n/a

Default Re: How to: Launch A Console Appplication in Hidden Mode? - 06-22-2006 , 09:24 AM






On Thu, 22 Jun 2006 09:17:33 -0400, "ESmith"
<eliana_smith (AT) hotmail (DOT) com> wrote:

Quote:
I want to create a small console application that essentially gets some
information and then launches a Windows Application. What I want to do is
have the console application launched in hidden mode - I know how to do this
from with a Windows Application by creating a Process and using StartInfo,
but how can I configure a console application to run in hidden mode from
startup?

What about starting a hidden Windows application that does nothing
except run the console application? It is not at all elegant, but you
already know how to do it and it will work.




Reply With Quote
  #3  
Old   
Noah Stein
 
Posts: n/a

Default Re: How to: Launch A Console Appplication in Hidden Mode? - 06-22-2006 , 07:26 PM



Execute it with a System.Diagnostics.Process. You can set the property
CreateNoWindow to false. You can also have it redirect standard output so
that you can send the text written out anywhere you want. Here's some code
from one of my VBA macros:

Dim p As System.Diagnostics.Process = New System.Diagnostics.Process
p.StartInfo.FileName = "myeditor"
p.StartInfo.WorkingDirectory = doc.Path
p.StartInfo.Arguments = Cmd$ & " " & doc.Name
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.CreateNoWindow = True
p.Start()
p.WaitForExit()

Good luck.


-- Noah

"ESmith" <eliana_smith (AT) hotmail (DOT) com> wrote

Quote:
I want to create a small console application that essentially gets some
information and then launches a Windows Application. What I want to do is
have the console application launched in hidden mode - I know how to do
this from with a Windows Application by creating a Process and using
StartInfo, but how can I configure a console application to run in hidden
mode from startup?

TIA




Reply With Quote
  #4  
Old   
Michael D. Ober
 
Posts: n/a

Default Re: How to: Launch A Console Appplication in Hidden Mode? - 06-22-2006 , 11:48 PM



Since you are creating the console application, how about creating a
WinForms application that starts with Sub Main(). In Sub Main, you do your
data gathering and initialization and then issue Form1.ShowDialog. The Sub
Main() will stop and wait for the form to be closed before continuing.

Mike Ober.

"ESmith" <eliana_smith (AT) hotmail (DOT) com> wrote

Quote:
I want to create a small console application that essentially gets some
information and then launches a Windows Application. What I want to do is
have the console application launched in hidden mode - I know how to do
this
from with a Windows Application by creating a Process and using StartInfo,
but how can I configure a console application to run in hidden mode from
startup?

TIA







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.