Hi code gurus !
I'm creating a front end for a DOS application using VB .Net. I launch this
DOS app using System.Diagnostics.Process :
myProcess.StartInfo.FileName = "myapp.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
I want to send a CTRL-C event to the DOS app, since it's the only way to
interrupt it (unfortunately I'm not the author so I can't change this).
I tried to send a CTRL-C event using the "ConsoleCtrlEvent" API, with no
success. I tried both :
GenerateConsoleCtrlEvent(ConsoleCtrlEvent.CTRL_C, 0)
and
GenerateConsoleCtrlEvent(ConsoleCtrlEvent.CTRL_C, myprocess.id)
But none of them seems to work.
So if someone can help me, I'd be very grateful.
Thank you in advance !
F.C 4 4113
On Wed, 27 Oct 2004 14:47:48 +0200, F.C. wrote: Hi code gurus !
myProcess.StartInfo.RedirectStandardInput = True
I want to send a CTRL-C event to the DOS app, since it's the only way to interrupt it (unfortunately I'm not the author so I can't change this).
Since you have redirected the standard input, can't you just send a CTRL-C
character into the input stream?
I haven't tried this, but it may work.
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
myStreamWriter.Write(Chr(3))
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Hi Chris,
Thanks a lot for your reply. Unfortunately, I just tested and it didn't
work. I also tried chr(26), which is equivalent to Ctrl-Z (sometimes Unix
apps use this hotkey).
It was a smart suggestion though, but it seems I'm still stuck <:)
Regards
F.C.
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> a écrit dans
le message de news: 17*****************************@40tude.net... On Wed, 27 Oct 2004 14:47:48 +0200, F.C. wrote:
Hi code gurus !
myProcess.StartInfo.RedirectStandardInput = True
I want to send a CTRL-C event to the DOS app, since it's the only way to interrupt it (unfortunately I'm not the author so I can't change this).
Since you have redirected the standard input, can't you just send a CTRL-C character into the input stream?
I haven't tried this, but it may work.
Dim myStreamWriter As StreamWriter = myProcess.StandardInput myStreamWriter.Write(Chr(3))
-- Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address.
On Wed, 27 Oct 2004 19:06:26 +0200, F.C. wrote: Thanks a lot for your reply. Unfortunately, I just tested and it didn't work. I also tried chr(26), which is equivalent to Ctrl-Z (sometimes Unix apps use this hotkey).
After writing to the stream, did you flush the stream? Perhaps that will
help to make sure all the data gets sent:
myStreamWriter.Flush()
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Hmmm, I just tried this too, but it didn't work either. I'm not sure if the
application reacts to a caracter in its input stream, or to a direct
keypress, but it seems it's the second solution unfortunately.
I was hoping the GenerateConsoleCtrlEvent API would simulate this in a
trickiest manner, but I got no results at all.
Anyways, thanks again for your suggestions :)
Bye
F.C.
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> a écrit dans
le message de news: yd****************************@40tude.net... On Wed, 27 Oct 2004 19:06:26 +0200, F.C. wrote:
Thanks a lot for your reply. Unfortunately, I just tested and it didn't work. I also tried chr(26), which is equivalent to Ctrl-Z (sometimes Unix apps use this hotkey).
After writing to the stream, did you flush the stream? Perhaps that will help to make sure all the data gets sent:
myStreamWriter.Flush()
-- Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and replace certain words in my E-Mail address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jas |
last post by:
I have a basic client/server socket situation setup....where the server
accepts a connection and then waits for commands.
On the client side, I create a socket, connect to the server...then I...
|
by: Gary |
last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering
the Ctrl+P key.
Syntax:
System.Windows.Forms.SendKeys.Send("^(P)");
This is not working ..what could be the...
|
by: Gary |
last post by:
Hi,
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering
the Ctrl+P key.
Syntax:
System.Windows.Forms.SendKeys.Send("^(P)")
This is not working ..what could be the...
|
by: Str Noetika |
last post by:
Hi,
How can I send ctrl keys (like ctrl A, ctrl C) from a VB application to
another existing application (like word, excel...) ? I tried to send
postmessages like...
|
by: B Loggins |
last post by:
Hi everyone, thanks in advance fo any help on this issue.
I'm trying to "wrap" cmd.exe. That is, I'm redirecting StandardInput
and StandardOutput for a cmd.exe process and I'm sending StdOut to...
|
by: William Stacey [MVP] |
last post by:
How do you send Ctrl-C to a standard input stream? Just sending 03 does not
work.
--
William Stacey
|
by: abhay |
last post by:
hi,i m interfacing gsm modem to my microcontroller.i need to send sms
through it.
i am using AT commands for that.the command to send sms (AT+ CMGS)
terminates with
ctrl-Z.now in my program i hav...
|
by: misbahCU |
last post by:
I am trying to make a script so that it can automate the basic functionality of the router like the logins and the password recovery. For this i am required to send the Ctrl+z, i tried using the...
|
by: zlf |
last post by:
Hello
I'm writing testcase for my console application. One testcase requires to
test press Ctrl+C while the application is running.
How to send Ctrl+C while running application through...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |