#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
PROCESS_INFORMATION* _handle;
/* exec由绝对路径和参数构成 */
int Excute(string& exec)
{
STARTUPINFOA si;
PROCESS_INFORMATION* pi = new PROCESS_INFORMATION;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( pi, sizeof(PROCESS_INFORMATION) );
// Start the child process.
if( !CreateProcessA( NULL, // No module name (use command line)
(LPSTR)exec.c_str(), // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
(LPSTARTUPINFOA)&si, // Pointer to STARTUPINFO structure
pi ) // Pointer to PROCESS_INFORMATION structure
)
{
r
CreateProcess函数调用python文件
最新推荐文章于 2021-02-12 09:14:47 发布