468,321 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

abort/pause a hidden DOS program

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
0 950

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Amit Nath | last post: by
11 posts views Thread by Paminu | last post: by
1 post views Thread by desktop | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.