var
 MyHandle: THandle;
 Struct: TProcessEntry32;
 pathstr: string;
 SL: TStringList;
 begin
 ListBox3.ItemIndex :=0;
 ListBox1.Clear;
    try
      MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPProcess, 0);
      Struct.dwSize:=Sizeof(TProcessEntry32);
      if Process32First(MyHandle, Struct) then
         begin
           pathstr := GetMFEx(Struct.Th32ProcessID);
         //  ListBox1.Items.Add(pathstr);
          if ((copy(pathstr,1,1)='C') or (copy(pathstr,1,1)='D') or (copy(pathstr,1,1)='E') ) then ListBox1.Items.Add(pathstr);
        end;
       while Process32Next(MyHandle, Struct) do
          begin
            pathstr := GetMFEx(Struct.Th32ProcessID);
          // ListBox1.Items.Add(pathstr);

  pathstr:=trim(pathstr);
  if ((copy(pathstr,1,1)='C') or (copy(pathstr,1,1)='D') or (copy(pathstr,1,1)='E') ) then ListBox1.Items.Add(pathstr);
          end;
    except
      ShowMessage('Error showing process list');
    end;
while Process32Next(MyHandle, Struct) do kısmında overflow hatası alıyorum. Biraz araştırdım, sonsuz döngüye girdiği için diyor herkes. Belirli işlemler sonucu düzenli olarak bu prosedürü çalıştırıyorum. 20-25 dakika sonra program hata veriyor.