开发者

Send Ctrl+C to process

I have to se开发者_开发知识库nd to send Ctrl+C to console process created from my C# application. I have found a lot of similar threads but haven't found a solutaion (tried CreateProcess, GenerateConsoleCtrlEvent, etc.). Is there any working example?


The key CRTL + C is ASCII 3 (in decimal)

myProcess.StartInfo.FileName = "Sort.exe";
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.Start();
StreamWriter myStreamWriter = myProcess.StandardInput;
myStreamWriter.WriteLine(inputText);

Ref: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardinput.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜