I found references to suggesting using ShellExecuteEx(). Here's the source code example of how to do this:
// This will launch the lpFile and wait for it to exit SHELLEXECUTEINFO info; memset(&info, 0, sizeof(SHELLEXECUTEINFO)); info.cbSize = sizeof(SHELLEXECUTEINFO); info.fMask = SEE_MASK_NOCLOSEPROCESS; info.lpVerb = L"open"; info.lpFile = "foo.exe"; info.nShow = SW_SHOWNORMAL; ShellExecuteEx(&info); // Wait until child process exits. WaitForSingleObject(info.hProcess, INFINITE); CloseHandle(info.hProcess);
Note that you are responsible for closing the handle since using the SEE_MASK_NOCLOSEPROCESS flag tells ShellExecuteEx() to leave the handle open.