473,651 Members | 2,775 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.Start Info.FileName = "cmd"
myProcess.Start Info.UseShellEx ecute = False
myProcess.Start Info.CreateNoWi ndow = True
myProcess.Start Info.RedirectSt andardInput = True
myProcess.Start Info.RedirectSt andardOutput = True
myProcess.Start Info.RedirectSt andardError = True

myProcess.Start ()

Dim sIn As IO.StreamWriter = myProcess.Stand ardInput
sIn.AutoFlush = True

Dim sOut As IO.StreamReader = myProcess.Stand ardOutput
Dim sErr As IO.StreamReader = myProcess.Stand ardError

sIn.Write("cd C:\myFolder" & System.Environm ent.NewLine)
sIn.Write("Some Program" & System.Environm ent.NewLine)
sIn.Write("exit " & System.Environm ent.NewLine)

While Not myProcess.HasEx ited
myString = sOut.ReadLine
TextBox1.Text = myString
If InStr(myString, "LoadStep") 0 Then
TextBox2.Text = myString
End If
Application.DoE vents()
End While

If Not myProcess.HasEx ited Then
myProcess.Kill( )
End If

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

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

Similar topics

10
5159
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 program keeps on running. Can someone please help me on that. AN
11
39876
by: Paminu | last post by:
Is there something like system("PAUSE") for linux?
1
1114
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 CMyclass::OnKeyDown(UINT nChar,...) won't work when the program doesn't have the focus, so what i can do? thanx..
38
3987
by: Jackie | last post by:
I just want the programme to stop for a while. Thanks.
14
3436
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 program can save all running data to a file when I want it to stop, and can reload the data and continue to run from where it stops when the computer is free ?
5
1577
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
6485
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
2805
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 the loop.
1
1622
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 a friend of mine in C#. the only problem i am having is that the application hangs when i perform a certain function when processing customers details.in java,i know how to slow down the application,but in C# i dont really know how. i have tried...
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.