How to hide a console window?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terry Olsen

    #1

    How to hide a console window?

    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?

    *** Sent via Developersdex http://www.developersdex.com ***
  • Crouchie1998

    #2
    Re: How to hide a console window?

    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.St artupPath,
    "MyApp.exe" )

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    Dim psi As New System.Diagnost ics.ProcessStar tInfo(strConsol e)
    psi.WindowStyle = ProcessWindowSt yle.Hidden

    Dim p As New System.Diagnost ics.Process
    p.Start(psi)

    Application.Exi t()

    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


    Comment

    Working...