SHELLEXECUTEINFO si; ZeroMemory(&si, sizeof(si)); si.cbSize = sizeof(si); si.fMask = SEE_MASK_NOCLOSEPROCESS; si.lpVerb = _T("open"); si.lpFile = _T("notepad.exe"); si.nShow = SW_SHOWNORMAL; ShellExecuteEx(&si); DWORD dwExitCode; GetExitCodeProcess(si.hProcess,&dwExitCode); while (dwExitCode == STILL_ACTIVE) { Sleep((DWORD)5); GetExitCodeProcess(si.hProcess, &dwExitCode); } CloseHandle(si.hProcess);