473,503 Members | 4,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

Thanks

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

myProcess.Start()

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
Application.DoEvents()
End While

If Not myProcess.HasExited Then
myProcess.Kill()
End If

sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Jul 17 '06 #1
0 1100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5142
by: Amit Nath | last post by:
Hi! I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the...
11
39852
by: Paminu | last post by:
Is there something like system("PAUSE") for linux?
1
1103
by: nassar | last post by:
I want to know how i can make my program always get the messages sent by keyboard even when its window is hidden, minimized, or not in focus? i know that the usual message handlers like: void...
38
3960
by: Jackie | last post by:
I just want the programme to stop for a while. Thanks.
14
3418
by: fdu.xiaojf | last post by:
Hi, I have a program which will continue to run for several days. When it is running, I can't do anything except waiting because it takes over most of the CUP time. Is it possible that the...
5
1572
by: atlkhan | last post by:
I want to pause/ wait my program for few minutes. Can someone please guide me how I can do that. Thanks
5
6466
by: CoderMarc | last post by:
Hi, I can not get the system pause to work in a simple program. Here is my program below: // i/o example #include <iostream> using namespace std; int main ()
1
2798
by: desktop | last post by:
Is there someway to pause the execution of a program? I have a large while loop and before it gets started I would like to pause the program so I can see the output before it gets overwritten by...
1
1618
by: holly85 | last post by:
Hi all! i am new to this site,i came across it while i was searching through google. anyway my name is holly and i am a programmer in london...ect ect. i have just programmed a application for...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.