You can try ResetEvent or change this event handle to an "empty" event you only create but never fire, but I think the best way is to recreate the handle array without the process handle (be aware of that also the WAIT_OBJECT_0 + x value for all other events (after the process handle) changes if you remove this handle). Here some pseudocode how I would solve this problem.
#define TIMEOUT_EVENT 0
struct WaitObject
{
HANDLE hWaitFor;
int nEventId;
}
int WaitForObjects(WaitObject[] waitObjects, bool bWaitAny, ....)
{
int nRetVal = 0;
int nLoop = 0;
HANDLE arrayWaitObjectHandles[waitObjects.Length]; // ok its not really C ^^
for(; nLoop < waitObjects.Length; nLoop++)
arrayWaitObjectHandles[nLoop] = waitObjects[nLoop].hWaitFor;
nRetVal = WaitForMultipleObjects(waitObjects.Length, &arrayWaitObjectHandles, ...);
if(nRetVal == TIMEOUT)
return TIMEOUT\_EVENT;
return waitObjects\[nRetVal - WAIT\_OBJECT\_0\].nEventId;
}
I know that this is not fully C (its too long ago^^) but I hope you understand the idea behind this, just to build a function that waits for you and returns event ids (you assigned), so it will be easier to remove the process handle from this array, because you waits for your assigned event ids. I hope that helps. PS: Viel Spass damit! ;P
Greetings Covean