uses tlhelp32;procedure TForm1.Button1Click(Sender: TObject);
var lppe:Tprocessentry32;
hh:Thandle;
begin
hh:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
if process32first(hh,lppe) then
repeat
listbox1.items.add(format('<%x>%s',[lppe.th32ProcessID,extractfilename(lppe.szExeFile)]));
until not process32next(hh,lppe);
CloseHandle(hh);
end;
var lppe:Tprocessentry32;
hh:Thandle;
begin
hh:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
if process32first(hh,lppe) then
repeat
listbox1.items.add(format('<%x>%s',[lppe.th32ProcessID,extractfilename(lppe.szExeFile)]));
until not process32next(hh,lppe);
CloseHandle(hh);
end;
if return<0 then
fail
else
succ