How to hide a console window?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

I would like to hide a console window on startup so that the user can't
close it. is this possible? If so, how would I also show it when I
want to view it?
 
Hi Terry,

Is there another application launching your console application? If not, you
could create a simple program:

Start a new Windows application
Set ShowInTaskbar = False
Opacity = 0%

Double-click form load & do something like this:

Dim strConsole As String = IO.Path.Combine(Application.StartupPath,
"MyApp.exe")

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim psi As New System.Diagnostics.ProcessStartInfo(strConsole)
psi.WindowStyle = ProcessWindowStyle.Hidden

Dim p As New System.Diagnostics.Process
p.Start(psi)

Application.Exit()

End Sub

I have called 'MyApp.exe' the console project, so you will need to rename it

You will also need to copy your console app to the exe directory of your
built Windows application executable

When you run the Windows app it starts the console application & then
closes.

I hope this gives you an idea of how you could approach this

Crouchie1998
BA (HONS) MCP MCSE
 
Back
Top