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

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

1个回答

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();

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问