1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
STARTUPINFO si; //启动信息 memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; PROCESS_INFORMATION pi; //进程信息 if(!CreateProcess("c:\\windows\\system32\\notepad.exe",NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) { MessageBox("Create Fail!"); return; } //等待notepad.exe退出之后,执行MessageBox WaitForSingleObject(pi.hProcess, INFINITE); MessageBox("exit"); |
转载请注明:exchen's blog » 等待 CreateProcess 进程退出