Project 두 개를 합치고 싶기는 하지만,
이름이 충돌해서 합치는 것이 곤란하다.
그래서 분리된 실행 파일로 놓고 한 실행 파일에서 다른 실행 파일을 호출하고 끝날 때까지 기다리도록 했다.
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, // No module name (use command line)
"c:\\Temp\\Optimizer.exe", // 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
) {
printf( "CreateProcess failed (%d).\n", GetLastError() );
return -6;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );