found := 0;
for i := 0 to 767 do
begin
ReadProcessMemory(Hdl, PTR + i*4, @LootPTR, 4, BytesRead);
if LootPTR <> 0 then
begin
ReadProcessMemory(Hdl, …., @LootData, 4, BytesRead);
…..
inc(found);
if found = count then // если число найденных = общем числу, остановить перебор
break;
end;
end;
не будет никаких явных задержек. // заполняем случайные ячейки RandArray
for I := 0 to 10000 do
begin
num := RandomRange(0,100000);
if RandArray[num] = 0 then
RandArray[num] := 1;
end;
// перебор всего массива
for I := 0 to 100000 do
begin
if RandArray[i] <> 0 then
FoundArray[i] := 1;
end;
// останавливаем перебор, если найдены все 10000 значений
found := 0;
for I := 0 to 100000 do
begin
if RandArray[i] <> 0 then
begin
FoundArray[i] := 1;
inc(found);
if found = 10000 then
break;
end;
end;