How to hide the DOS window?

T

Thom

I am relativly new to vb.net ..... heck I'm new to VB in any version. So I
apologize if this is overly dumb.

I am trying to start and stop a particular file using the process.start()
and process.kill().
These are working but the DOS window is always appearing.

What am I missing to hide the DOS window?

I have tried .hidden, .minimized, removed the window style completeley. I
haven't found a way to hide the DOS window.

Any help is appreciated.

Dim mProcess As Process 'form level

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
mProcess = New Process
With mProcess.StartInfo
..FileName = "repstore.exe"
..Arguments = "3104"
..UseShellExecute = False
..WindowStyle = ProcessWindowStyle.Hidden
..RedirectStandardOutput = True
..RedirectStandardInput = True
End With
End Sub

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStart.Click
mProcess.Start()
End Sub

Private Sub btnStop_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnStop.Click
mProcess.Kill()
End Sub
 
C

Cor Ligthert

Hi Thom,

I had in the same situation to add this to get the result you want.
mprocess.StartInfo.CreateNoWindow = True

Maybe it gives the result you want?

Cor

"> I am relativly new to vb.net ..... heck I'm new to VB in any version. So
I
 
H

Herfried K. Wagner [MVP]

* "Thom said:
I am relativly new to vb.net ..... heck I'm new to VB in any version. So I
apologize if this is overly dumb.

I am trying to start and stop a particular file using the process.start()
and process.kill().
These are working but the DOS window is always appearing.

What am I missing to hide the DOS window?

I have tried .hidden, .minimized, removed the window style completeley. I
haven't found a way to hide the DOS window.

Set your 'ProcessStartInfo'/'StartInfo''s 'CreateNoWindow' property to 'True'.
 
T

Thom

Thank you Cor and Herfried.....that did the trick. I guess from my point of
view that was too easy and I should have seen it. I feel pretty dumb about
now.

Thanks again.
Thom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top