By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

abort/pause a hidden DOS program

P: n/a
Hello all.

I am currently working on a program in VB.NET where the user can run a
"hidden" DOS program and as the program is running the user can see how many
computations have been performed by the program. To do this i am "piping"
information back and forth between DOS and VB.NET.
I also want to make the user able to abort and/or pause the computations in
DOS. My question is how i can abort/pause a running DOS program. The only way
to stop the program when the DOS prompt is not hidden, is by Ctrl+C.
The code so far can be seen below.


Button1.Enabled = False
Dim myString As String
myProcess.StartInfo.FileName = "cmd"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True


Dim sIn As IO.StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True

Dim sOut As IO.StreamReader = myProcess.StandardOutput
Dim sErr As IO.StreamReader = myProcess.StandardError

sIn.Write("cd C:\myFolder" & System.Environment.NewLine)
sIn.Write("SomeProgram" & System.Environment.NewLine)
sIn.Write("exit" & System.Environment.NewLine)

While Not myProcess.HasExited
myString = sOut.ReadLine
TextBox1.Text = myString
If InStr(myString, "LoadStep") 0 Then
TextBox2.Text = myString
End If
End While

If Not myProcess.HasExited Then
End If

Jul 17 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.