ProcessStartInfo.CreateNoWindow Property

 

Gets or sets a value indicating whether to start the process in a new window.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

Public Property CreateNoWindow As Boolean

Property Value

Type: System.Boolean

true if the process should be started without creating a new window to contain it; otherwise, false. The default is false.

If the UseShellExecute property is true or the UserName and Password properties are not null, the CreateNoWindow property value is ignored and a new window is created.

Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
    Class MyProcess
        Public Shared Sub Main()
            Dim myProcess As New Process()

            Try
                myProcess.StartInfo.UseShellExecute = False
                ' You can start any process, HelloWorld is a do-nothing example.
                myProcess.StartInfo.FileName = "C:\\HelloWorld.exe"
                myProcess.StartInfo.CreateNoWindow = True
                myProcess.Start()
                ' This code assumes the process you are starting will terminate itself. 
                ' Given that is is started without a window so you cannot terminate it 
                ' on the desktop, it must terminate itself or you can do it programmatically
                ' from this application using the Kill method.
            Catch e As Exception
                Console.WriteLine((e.Message))
            End Try
        End Sub 'Main
    End Class
End Namespace

.NET Framework
Available since 1.1
Return to top
Show: