unit myproc2 ;
{Ver 1.0 }
interface
uses   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
       StdCtrls, Buttons, ComCtrls, TlHelp32, RichEdit,mystr;
 
var ListProc2:tStringList;
procedure FillProcessList;

implementation
procedure FillProcessList;
var SnapProc:THandle;
     ProcEntry:TProcessEntry32;
     St1,St2,st3,St4,St5,St6,St7,st8,st9,st10:string;
begin
ListProc2.Clear;

SnapProc:=CreateToolhelp32Snapshot(TH32CS_SnapProcess,0);
   if SnapProc<>Invalid_Handle_Value then
    try
     ProcEntry.dwSize:=SizeOf(TProcessEntry32);
     if Process32First(SnapProc,ProcEntry) then
      repeat
       St1:=IntToStr(ProcEntry.th32ProcessID);
       St2:=IntToStr(ProcEntry.th32ParentProcessID);
       St3:=ProcEntry.szExeFile;
       St4:=IntToStr(ProcEntry.dwSize);

       St5:=IntToStr(ProcEntry.cntUsage);
       St6:=IntToStr(ProcEntry.th32ModuleID);
       St7:=IntToStr(ProcEntry.th32DefaultHeapID);
       St8:=IntToStr(ProcEntry.cntThreads);
       St9:=IntToStr(ProcEntry.pcPriClassBase);
       St10:=IntToStr(ProcEntry.dwFlags);

       ListProc2.add(St3+'|'+st1+'|'+st2+'|'+St4+'|'+St5+'**'+St6+'|'+St7+'|'+St8+'|'+St9+'|'+St10);
      until not Process32Next(SnapProc,ProcEntry)
    finally
     CloseHandle(SnapProc)
    end

end;

end.
