将.exe调用到mfc项目 [英] Call .exe to mfc project

查看:83
本文介绍了将.exe调用到mfc项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在按钮点击事件上调用.exe(DSP到DAA转换执行程序)



如何将文本文件作为输入传递给.exe文件



在文本文件中包含需要从.DSP转换为.DAA文件的.DSP文件名列表



每当我点击.exe按钮点击它就应该要求输入文本文件名。



有没有其他方法(比ShellExecute)调用exe文件mfc vc ++。



谢谢

I want to call .exe (DSP to DAA conversion executive) on button clicked event

how i can pass text file as an input to .exe file

In text file contain list of .DSP file names which needs to be convert from .DSP to .DAA files

whenever i called .exe on button clicked it should asks to enter text file name.

is there any other method (than ShellExecute)to call exe file in the mfc vc++.

Thank you

推荐答案

使用 ShellExecute [ ^ ], ShellExecuteEx [ ^ ],系统 [ ^ ]调用您的EXE。
Use ShellExecute[^], ShellExecuteEx[^], system[^] to call your EXE.


您可以通过* .EXE文件的名称启动应用程序使用函数 CreateProcess ShellExecute ShellExecuteEx

http:// msdn。 microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/桌面/ bb762154%28V = vs.85%29.aspx [<啊ref =http://msdn.microsoft.com/en-us/library/windows/desktop/bb762154%28v=vs.85%29.aspxtarget =_ blanktitle =New Window> ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx [ ^ ]。



只有当应用程序被设计为接受此数据时,您才能将任何内容传递给您正在启动的进程:文件名或任何内容。通常,好的应用程序可以接受和处理命令行参数。启动应用程序时,您始终可以指定一些命令行参数,这些参数在上面引用的MSDN帮助文章中有说明。



如果需要传递一些文件名要求用户;并且它没有在您正在启动的应用程序中完成,您应该使用标准MFC文件对话框在UI中请求该文件,然后将其传递给应用程序(当然,如果它被设计为接受它)。请参阅:

http:// msdn .microsoft.com / zh-CN / library / dk77e5e7%28v = vs.71%29.aspx [ ^ ]。



您的申请应该负责准备文件,文件转换,适当的文件类型和类似的一切。接受和处理文件取决于你开始运行的应用程序。



这就是说,依靠某些不是应用程序的应用程序总是很糟糕你解决方案的一部分。您对此类应用程序的控制总是非常有限。如果您有可以支持的此应用程序的源代码,则建议将其转换为DLL以供进程内使用;这样你就可以获得完全的控制权。



-SA
You can start an application by the name of its *.EXE file using the function CreateProcess, ShellExecute or ShellExecuteEx:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762154%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx[^].

You can pass anything to the process you are starting only if the application is designed to accept this data: file name or anything at all. Usually, good application can accept and handle command line parameters. When you start an application, you can always specify some command line parameters, which is documented in the MSDN help articles referenced above.

If you need to pass some file name to be requested from the user; and it is not done in the application your are starting, you should request the file in your UI using the standard MFC file dialog and then pass it to the application (if it is designed to accept it, of course). Please see:
http://msdn.microsoft.com/en-us/library/dk77e5e7%28v=vs.71%29.aspx[^].

You application should be responsible for preparation of the file, file conversion, proper file type and everything like that. The accepting and processing of the file depends on how the application you start works.

That said, it''s always bad to rely on some application which is not a part of your solution. You always have very limited control over such application. If you have the source code of this application which you can support, it''s much advised to convert it to a DLL for in-proc use; this way you would gain a full control.

—SA


这篇关于将.exe调用到mfc项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆