如何在MFC中使用命令行(设置命令和读取结果) [英] How to use the command line(set command & read result) in MFC
问题描述
大家好:
我可以使用命令行来获取电源GUID,
像这样:
http://i.imgur.com/86xoMQo.jpg [ ^ ]
如果我想设置命令并使用MFC获取结果,我该怎么做?
我研究了这些文章,比如
http://stackoverflow.com/questions/5562877/how-to-get-the-command-line-arguments-in-mfc-applications 一> [ ^ ]
命令行类 [ ^ ]
但我仍然没有指示如何做到这一点?
希望有人可以帮助我,
谢谢你!
最好的考虑。
< blockquote>创建一个Pipe,重定向一个新进程的stdin和stdout,它执行你想要的命令。
http://msdn.microsoft.com/en-us/library/ms682499.aspx [ ^ ]
等待之后completition和read输出来自Pipe的进程。
我发现很容易解决这个问题!
使用< b> ShellExecute< / b>函数可以解决问题。
Hi all:
I can use command line to get the power GUID,
like this:
http://i.imgur.com/86xoMQo.jpg[^]
If I want to set the command and get the result by using MFC, how I can do?
I have researched the articles, like
http://stackoverflow.com/questions/5562877/how-to-get-the-command-line-arguments-in-mfc-applications[^]
A Command Line Class[^]
but I still haven't direction how to do this?
Hope someone can help me,
thank you!
best regard.
Create a Pipe, redirect stdin and stdout of a new Process which executes the command you want.
http://msdn.microsoft.com/en-us/library/ms682499.aspx[^]
After That wait for completition and read Output of the Process from Pipe.
I found a easy to solve this problem!
Use <b>ShellExecute </b>function can complete the problem.
这篇关于如何在MFC中使用命令行(设置命令和读取结果)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!