启动shell应用程序,然后将命令传递给提示符. [英] Start shell application and pass command to the prompt.
问题描述
我有一个C ++应用程序,该应用程序生成了一个名为"rtireplaysh.exe"的外壳程序.
我使用shellexecute
执行rtishellsh.exe,可以使用CreateProcess
.
rtishellsh.exe除外的命令是停止,启动,暂停和恢复.
问题:
1.在Shell应用程序启动并运行后,如何将这些命令传递给提示符?
2.是否可以执行rtishellsh.exe并传递停止",开始",暂停"和恢复"?
有任何想法吗?
Hi,
I have a c++ application that spawns a shell program called, "rtireplaysh.exe".
I execute the rtishellsh.exe using shellexecute
and can use CreateProcess
.
The commands that rtishellsh.exe excepts are stop, start, pause and resume.
QUESTIONS:
1. After the shell application is up and running how can I pass these commands to the prompt?
2. Is there a way to execute rtishellsh.exe and pass "stop", "start", "pause" and "resume" ?
Any ideas?
推荐答案
使用CreateProcess,创建管道并将其作为hStdInput传递到STARTUPINFO结构中,然后可以将"stop""start"命令编写为管道,请参阅本文,了解如何重定向标准输入和标准输出
http://msdn.microsoft.com/zh-我们/library/windows/desktop/ms682499%28v=vs.85%29.aspx [
Use CreateProcess, create a pipe and pass it as a hStdInput in the STARTUPINFO structure and then you can write the "stop" "start" commands to the pipe, refer this article for how to redirect the stdin and stdout
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499%28v=vs.85%29.aspx[^]
CreateProcess
的文档http://msdn.microsoft.com/en-us/library/ms682425%28v= VS.85%29.aspx [ ^ ]显示了如何设置lpCommandLine
来将参数传递给应用程序,并讨论了应用程序如何获取这些参数.这应该可以解决问题.
The documentation forCreateProcess
http://msdn.microsoft.com/en-us/library/ms682425%28v=VS.85%29.aspx[^] shows how to set thelpCommandLine
to pass arguments to the application and discusses how the application can get those arguments. That should do the trick.
rtireplaysh.exe是第三方应用程序,我无法更改其接受命令的方式. rti.com/support建议使用fgets和fputs.
有趣的是,当我问他们这个问题时,他们说他们将创建一个增强功能,以便我可以构建一个新的xml文件,该文件可以由rtireplaysh.exe读取,并带有stop,start ....命令.
感谢您看一下.
rtireplaysh.exe is a 3rd party application and I cannot change how it accepts commands. rti.com/support recommended using fgets and fputs.
Funny part was when I asked them about this they said that they would create an enhancement so that I could build a new xml file that could be read by rtireplaysh.exe with the stop, start.... commands embedded.
Thanks for taking a look at this.
这篇关于启动shell应用程序,然后将命令传递给提示符.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!