控制台程序中用.bat调用外部的exe,如何得知exe什么时候结束.

waitforsingleobject不行啊,好像这个获取的是.bat的执行情况吧。求教。

SHELLEXECUTEINFOShExecInfo= {0};

ShExecInfo.cbSize=sizeof(SHELLEXECUTEINFO);

ShExecInfo.fMask=SEE_MASK_NOCLOSEPROCESS;

ShExecInfo.hwnd=NULL;

ShExecInfo.lpVerb=_T("open");

ShExecInfo.lpFile =_T("c4.5.exe");

ShExecInfo.lpParameters= _T("-ftrain");

ShExecInfo.lpDirectory= NULL;ShExecInfo.nShow = SW_HIDE;

ShExecInfo.hInstApp=NULL;

ShellExecuteEx(&ShExecInfo);

WaitCursorBegin();

WaitForSingleObject(ShExecInfo.hProcess,INFINITE);

WaitCursorEnd();