|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Process - RedirectStandardInput(Windows.Forms). I am using the method of launching the console app described in the msdn article: http://msdn.microsoft.com/msdnmag/issues/03/02/Multithreading/default.aspx The fortran app recognizes a user pressed ESC keystroke to shut down nicely (it is writing files etc...). I need to be able to do the same and not just kill the running process. I have attempted to send the app the ESC key through StdIn (I am using MC++): process = new Process; process->StartInfo->UseShellExecute = false; process->StartInfo->RedirectStandardInput = true; process->StartInfo->RedirectStandardOutput = true; process->StartInfo->RedirectStandardError = true; process->StartInfo->CreateNoWindow = true; process->StartInfo->FileName = "myfile"; process->StartInfo->Arguments = "myargs"; process->StartInfo->WorkingDirectory = "mydir"; process->Start(); MethodInvoker* thStdOut = new MethodInvoker(this, ReadStdOut) ; MethodInvoker* thStdErr = new MethodInvoker(this, ReadStdErr) ; //start reading StdOut and StdErr thStdOut->BeginInvoke(NULL,NULL); thStdErr->BeginInvoke(NULL,NULL); .... do some work... //send the escape key StreamWriter *streamWriter = process->StandardInput; if(process != NULL) { char esc = (char)0x1b; streamWriter->Write(esc); streamWriter->Flush(); } but this does nothing to stop the console app. I have also tried sending the escape key using SendKey like so: System::Windows::Forms::SendKeys::Send("{ESC}"); but this also does nothing to stop the console app. Any ideas or suggestions? Thank you in advance
Other interesting topics
Get the parent assembly
Convert a String into a Stream Bizarre Exception null value .Net Application crash No exception Thrown Re: File.Delete Cordbg.exe problem Repeater ItemCommand not firing Re: Is AxImp broken in SP3? - SOLVED Re: Array vs. ArrayList Re: C# application requires more than 1.4GB WorkingSet. |
|||||||||||||||||||||||