简体   繁体   English

C++ 启动进程/应用程序

[英]C++ Start Process / Application

I have a dll source file, I want to create a function in it, which call an exe.我有一个 dll 源文件,我想在其中创建一个调用 exe 的函数。

The exe is in the Data/Common/PPI.exe How can I start this from the c++ code? exe 位于 Data/Common/PPI.exe 如何从 C++ 代码启动? I tryed with CreateProcess and ShellExec, can anybody create an example for me to know how to make it, with this path and with this exe name.我尝试了 CreateProcess 和 ShellExec,任何人都可以创建一个示例让我知道如何使用此路径和此 exe 名称创建它。

I dont want to add the full directory path because if its changed or something I need to rebuild the exe... so the dll is in the root folder the dll call this function and the function start the Data/common/PPI.exe, thats it all.我不想添加完整的目录路径,因为如果它改变了或者我需要重建exe...所以dll在根文件夹中,dll调用这个函数并且函数启动Data/common/PPI.exe,就是这样。

Try the system command like this试试这样的系统命令

system(".\\Data\\Common\\PPI.exe")

and you need to include this:你需要包括这个:

#include <windows.h>

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

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