是否可以传递一个相对路径来创建我的子进程? 此代码将进行编译,但由于使用相对路径,因此会出现错误。使用CreateProcess和相对路径
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();
}
由于某种原因,今天它的工作。我已经放弃了子进程,并且正在使用Visual Studio来启动这两个项目。非常感谢! – toto 2010-12-21 15:39:25