C++ 使用具有相对路径的CreateProcess
是否可以传递相对路径来创建我的子进程? 这段代码将编译,但它给出了一个错误,因为我使用的是相对路径C++ 使用具有相对路径的CreateProcess,c++,windows,process,winapi,C++,Windows,Process,Winapi,是否可以传递相对路径来创建我的子进程? 这段代码将编译,但它给出了一个错误,因为我使用的是相对路径 void Cminivideo3App::creerChildProcess(void) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) );
void Cminivideo3App::creerChildProcess(void)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
int retvalue = CreateProcess( TEXT("\..\Debug\traitement.exe"), // No module name (use command line)
NULL, // 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
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
int lastError = GetLastError();
}
对我来说,这不是一条相对的道路
\
是当前驱动器的根文件夹。两件事:
\
是当前驱动器的根文件夹,而不是相对路径文本(“..\\Debug\\traitement.exe”)
由于某种原因,今天它起了作用。我已经放弃了子进程,我正在使用VisualStudio启动这两个项目。谢谢!