假如创建了两个进程:CreateProcess(FileName1,nil,nil,nil,true,0,nil,nil,lpSI1,lpPI1);
CreateProcess(FileName2,nil,nil,nil,true,0,nil,nil,lpSI2,lpPI2);HandleArray:array [0..1] of dword;HandleArray[0]:=lpPI1.hProcess;
HandleArray[1]:=lpPI2.hProcess;如何用WaitForMultipleObjects等待它们结束后,显示相应的信息?为什么这样不可以??
while true do
begin
dwEvent:=WaitForMultipleObjects(2,@HandleArray,false,INFINITE);
case dwEvent of
0:
showmessage('进程1结束');
1:
showmessage('进程2结束');
end;
end;
CreateProcess(FileName2,nil,nil,nil,true,0,nil,nil,lpSI2,lpPI2);HandleArray:array [0..1] of dword;HandleArray[0]:=lpPI1.hProcess;
HandleArray[1]:=lpPI2.hProcess;如何用WaitForMultipleObjects等待它们结束后,显示相应的信息?为什么这样不可以??
while true do
begin
dwEvent:=WaitForMultipleObjects(2,@HandleArray,false,INFINITE);
case dwEvent of
0:
showmessage('进程1结束');
1:
showmessage('进程2结束');
end;
end;
case dwEvent of
WAIT_OBJECT_0:
//...
WAIT_OBJECT_0 + 1:
//...