简体   繁体   English

Windows是否具有自己的“调用其他.exe”功能(C ++)

[英]Does Windows have its own 'call other .exe' function (C++)

I know in C++ there is a function 我知道在C ++中有一个功能

system("example.exe");

that runs another program, put it requires the include stdlib.h . 运行另一个程序,则需要include stdlib.h

Because I am already including 'windows.h', is there an equivilant to the system() function in Windows? 因为我已经包含“ windows.h”,所以Windows中的system()函数是否等效?

There is CreateProcess to run a specific executable, or ShellExecute to run programs or open documents with their associated program. CreateProcess可以运行特定的可执行文件,而ShellExecute可以运行程序或使用其关联程序打开文档。

If portability to other platforms is any issue at all, I'd stick with system. 如果根本不能移植到其他平台,我会坚持使用系统。 #including stdlib.h won't kill you ;) #包括stdlib.h不会杀死你;)

MSDN页面上查看CreateProcess以获取更多信息

我认为您在寻找CreateProcess吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM