Var
dwWaitResult : DWORD;
ThreadArray :
array[0..1]
of THandle;
// Handle Array um auf Threads zu warten
begin
SearchForCopy := TSearchCopy.Create(false);
SearchForCopy.FreeOnTerminate := False;
SearchForDelete := TSearchDelete.Create(false);
SearchForDelete.FreeOnTerminate := False;
ThreadArray[0] := SearchForCopy.Handle;
// Handle Array füllen
ThreadArray[1] := SearchForDelete;
repeat
// Auf Threads warten
dwWaitResult := msgWaitforMultipleObjects(length(ThreadArray), ThreadArray, true, 100, QS_ALLINPUT);
if dwWaitResult <> WAIT_OBJECT_0
then
begin
Application.ProcessMessages;
// GUI aktualisieren
end;
until dwWaitResult = WAIT_OBJECT_0;
// keinen Threads mehr zum warten
end;