等待调用的新进程执行完毕再继续执行本进程的方法

来源:互联网 发布:sql创建数据库代码 编辑:程序博客网 时间:2024/06/03 17:40
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\MyProgram.exe";                                                   //被调用进程的路径
ShExecInfo.lpParameters = "";                                                                    //传给被调用进程的参数,被调用进程可通过lpCommandLine获得
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
0 0
原创粉丝点击